Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 33c973a

Browse files
committed
feat: Add offset/length arguments to files.cat
1 parent 7c5cea5 commit 33c973a

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"ipfs-block": "~0.7.1",
3737
"ipfs-unixfs": "~0.1.14",
3838
"ipld-dag-cbor": "^0.12.0",
39-
"ipld-dag-pb": "^0.14.2",
39+
"ipld-dag-pb": "^0.14.3",
4040
"is-ipfs": "^0.3.2",
4141
"is-stream": "^1.1.0",
4242
"libp2p-crypto": "^0.13.0",
@@ -77,9 +77,9 @@
7777
"go-ipfs-dep": "^0.4.14",
7878
"gulp": "^3.9.1",
7979
"hapi": "^17.3.1",
80-
"interface-ipfs-core": "~0.61.0",
80+
"interface-ipfs-core": "^0.64.0",
8181
"ipfs": "~0.28.2",
82-
"ipfsd-ctl": "~0.32.0",
82+
"ipfsd-ctl": "^0.32.1",
8383
"pre-commit": "^1.2.2",
8484
"pull-stream": "^3.6.7",
8585
"socket.io": "^2.1.0",

src/files/cat-pull-stream.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ module.exports = (send) => {
1919
}
2020
}
2121

22-
send({ path: 'cat', args: hash, buffer: opts.buffer }, (err, stream) => {
22+
const query = {
23+
offset: opts.offset,
24+
length: opts.length
25+
}
26+
27+
send({ path: 'cat', args: hash, buffer: opts.buffer, qs: query }, (err, stream) => {
2328
if (err) { return p.end(err) }
2429

2530
p.resolve(toPull(stream))

src/files/cat-readable-stream.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ module.exports = (send) => {
1919
}
2020
}
2121

22-
send({ path: 'cat', args: hash, buffer: opts.buffer }, (err, stream) => {
22+
const query = {
23+
offset: opts.offset,
24+
length: opts.length
25+
}
26+
27+
send({ path: 'cat', args: hash, buffer: opts.buffer, qs: query }, (err, stream) => {
2328
if (err) { return pt.destroy(err) }
2429

2530
pump(stream, pt)

src/files/cat.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ module.exports = (send) => {
2020
}
2121
}
2222

23-
send({ path: 'cat', args: hash, buffer: opts.buffer }, (err, stream) => {
23+
const query = {
24+
offset: opts.offset,
25+
length: opts.length
26+
}
27+
28+
send({ path: 'cat', args: hash, buffer: opts.buffer, qs: query }, (err, stream) => {
2429
if (err) { return callback(err) }
2530

2631
stream.pipe(bl((err, data) => {

0 commit comments

Comments
 (0)