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

Commit f21ef75

Browse files
committed
doc: Documents the begin/end arguments to ipfs.files.cat and friends
1 parent bad70ac commit f21ef75

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

SPEC/FILES.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ pull(
161161
162162
##### `Go` **WIP**
163163

164-
##### `JavaScript` - ipfs.files.cat(ipfsPath, [callback])
164+
##### `JavaScript` - ipfs.files.cat(ipfsPath, [begin], [end], [callback])
165165

166-
ipfsPath can be of type:
166+
`ipfsPath` can be of type:
167167

168168
- [`cid`][cid] of type:
169169
- [Buffer][b], the raw Buffer of the cid
@@ -173,6 +173,8 @@ ipfsPath can be of type:
173173
- '/ipfs/QmXEmhrMpbVvTh61FNAxP9nU7ygVtyvZA8HZDUaqQCAb66/a.txt'
174174
- 'QmXEmhrMpbVvTh61FNAxP9nU7ygVtyvZA8HZDUaqQCAb66/a.txt'
175175

176+
`begin` is an optional byte offset to start the stream at
177+
`end` is an optional byte offset to stop the stream before
176178
`callback` must follow `function (err, file) {}` signature, where `err` is an error if the operation was not successful and `file` is a [Buffer][b]
177179

178180
If no `callback` is passed, a promise is returned.
@@ -197,9 +199,9 @@ A great source of [examples][] can be found in the tests for this API.
197199
198200
##### `Go` **WIP**
199201

200-
##### `JavaScript` - ipfs.files.catReadableStream(ipfsPath) -> [Readable Stream][rs]
202+
##### `JavaScript` - ipfs.files.catReadableStream(ipfsPath, [begin], [end]) -> [Readable Stream][rs]
201203

202-
ipfsPath can be of type:
204+
`ipfsPath` can be of type:
203205

204206
- [`cid`][cid] of type:
205207
- [Buffer][b], the raw Buffer of the cid
@@ -209,6 +211,9 @@ ipfsPath can be of type:
209211
- '/ipfs/QmXEmhrMpbVvTh61FNAxP9nU7ygVtyvZA8HZDUaqQCAb66/a.txt'
210212
- 'QmXEmhrMpbVvTh61FNAxP9nU7ygVtyvZA8HZDUaqQCAb66/a.txt'
211213

214+
`begin` is an optional byte offset to start the stream at
215+
`end` is an optional byte offset to stop the stream before
216+
212217
Returns a [Readable Stream][rs] with the contents of the file.
213218

214219

@@ -225,9 +230,9 @@ A great source of [examples][] can be found in the tests for this API.
225230
226231
##### `Go` **WIP**
227232

228-
##### `JavaScript` - ipfs.files.catPullStream(ipfsPath) -> [Pull Stream][rs]
233+
##### `JavaScript` - ipfs.files.catPullStream(ipfsPath, [begin], [end]) -> [Pull Stream][rs]
229234

230-
ipfsPath can be of type:
235+
`ipfsPath` can be of type:
231236

232237
- [`cid`][cid] of type:
233238
- [Buffer][b], the raw Buffer of the cid
@@ -237,6 +242,9 @@ ipfsPath can be of type:
237242
- '/ipfs/QmXEmhrMpbVvTh61FNAxP9nU7ygVtyvZA8HZDUaqQCAb66/a.txt'
238243
- 'QmXEmhrMpbVvTh61FNAxP9nU7ygVtyvZA8HZDUaqQCAb66/a.txt'
239244

245+
`begin` is an optional byte offset to start the stream at
246+
`end` is an optional byte offset to stop the stream before
247+
240248
Returns a [Pull Stream][ps] with the contents of the file.
241249

242250
```JavaScript

0 commit comments

Comments
 (0)