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

Commit ffa4f76

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

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

SPEC/FILES.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ pull(
159159
160160
##### `Go` **WIP**
161161

162-
##### `JavaScript` - ipfs.files.cat(ipfsPath, [callback])
162+
##### `JavaScript` - ipfs.files.cat(ipfsPath, [options], [callback])
163163

164-
ipfsPath can be of type:
164+
`ipfsPath` can be of type:
165165

166166
- [`cid`][cid] of type:
167167
- a [CID](https://github.com/ipfs/js-cid) instance
@@ -172,6 +172,10 @@ ipfsPath can be of type:
172172
- '/ipfs/QmXEmhrMpbVvTh61FNAxP9nU7ygVtyvZA8HZDUaqQCAb66/a.txt'
173173
- 'QmXEmhrMpbVvTh61FNAxP9nU7ygVtyvZA8HZDUaqQCAb66/a.txt'
174174

175+
`options` is an optional object that may contain the following keys:
176+
- `offset` is an optional byte offset to start the stream at
177+
- `count` is an optional number of bytes to read from the stream
178+
175179
`callback` must follow `function (err, file) {}` signature, where `err` is an error if the operation was not successful and `file` is a [Buffer][b]
176180

177181
If no `callback` is passed, a promise is returned.
@@ -196,9 +200,9 @@ A great source of [examples][] can be found in the tests for this API.
196200
197201
##### `Go` **WIP**
198202

199-
##### `JavaScript` - ipfs.files.catReadableStream(ipfsPath) -> [Readable Stream][rs]
203+
##### `JavaScript` - ipfs.files.catReadableStream(ipfsPath, [options]) -> [Readable Stream][rs]
200204

201-
ipfsPath can be of type:
205+
`ipfsPath` can be of type:
202206

203207
- [`cid`][cid] of type:
204208
- a [CID](https://github.com/ipfs/js-cid) instance
@@ -209,6 +213,10 @@ ipfsPath can be of type:
209213
- '/ipfs/QmXEmhrMpbVvTh61FNAxP9nU7ygVtyvZA8HZDUaqQCAb66/a.txt'
210214
- 'QmXEmhrMpbVvTh61FNAxP9nU7ygVtyvZA8HZDUaqQCAb66/a.txt'
211215

216+
`options` is an optional object that may contain the following keys:
217+
- `offset` is an optional byte offset to start the stream at
218+
- `count` is an optional number of bytes to read from the stream
219+
212220
Returns a [Readable Stream][rs] with the contents of the file.
213221

214222

@@ -225,9 +233,9 @@ A great source of [examples][] can be found in the tests for this API.
225233
226234
##### `Go` **WIP**
227235

228-
##### `JavaScript` - ipfs.files.catPullStream(ipfsPath) -> [Pull Stream][rs]
236+
##### `JavaScript` - ipfs.files.catPullStream(ipfsPath, [options]) -> [Pull Stream][rs]
229237

230-
ipfsPath can be of type:
238+
`ipfsPath` can be of type:
231239

232240
- [`cid`][cid] of type:
233241
- [Buffer][b], the raw Buffer of the cid
@@ -237,6 +245,10 @@ ipfsPath can be of type:
237245
- '/ipfs/QmXEmhrMpbVvTh61FNAxP9nU7ygVtyvZA8HZDUaqQCAb66/a.txt'
238246
- 'QmXEmhrMpbVvTh61FNAxP9nU7ygVtyvZA8HZDUaqQCAb66/a.txt'
239247

248+
`options` is an optional object that may contain the following keys:
249+
- `offset` is an optional byte offset to start the stream at
250+
- `count` is an optional number of bytes to read from the stream
251+
240252
Returns a [Pull Stream][ps] with the contents of the file.
241253

242254
```JavaScript

0 commit comments

Comments
 (0)