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

Commit 7fd182e

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

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
@@ -161,9 +161,9 @@ pull(
161161
162162
##### `Go` **WIP**
163163

164-
##### `JavaScript` - ipfs.files.cat(ipfsPath, [callback])
164+
##### `JavaScript` - ipfs.files.cat(ipfsPath, [options], [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,10 @@ ipfsPath can be of type:
173173
- '/ipfs/QmXEmhrMpbVvTh61FNAxP9nU7ygVtyvZA8HZDUaqQCAb66/a.txt'
174174
- 'QmXEmhrMpbVvTh61FNAxP9nU7ygVtyvZA8HZDUaqQCAb66/a.txt'
175175

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

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

200-
##### `JavaScript` - ipfs.files.catReadableStream(ipfsPath) -> [Readable Stream][rs]
204+
##### `JavaScript` - ipfs.files.catReadableStream(ipfsPath, [options]) -> [Readable Stream][rs]
201205

202-
ipfsPath can be of type:
206+
`ipfsPath` can be of type:
203207

204208
- [`cid`][cid] of type:
205209
- [Buffer][b], the raw Buffer of the cid
@@ -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)