-
Notifications
You must be signed in to change notification settings - Fork 108
docs: adds stream-related mfs files.read method signatures #265
Conversation
SPEC/FILES.md
Outdated
|
||
##### `Go` **WIP** | ||
|
||
##### `JavaScript` - ipfs.files.readReadableStream(path, [options], [callback]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/readReadableStrem/readPullStream
probably bad c&p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, good catch - thanks, have updated
SPEC/FILES.md
Outdated
@@ -709,11 +709,11 @@ ipfs.files.rm('/my/beautiful/directory', { recursive: true }, (err) => { | |||
|
|||
#### `read` | |||
|
|||
> Read a file. | |||
> Read a file into a [`Buffer`][b]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@achingbrain what about the write methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They were outside of the scope of the original conversation. Currently you can pass a number of types of content to the write
command and it'll convert them all into a pull-stream internally. I've updated the docs in this PR to show what we now support.
SPEC/FILES.md
Outdated
|
||
Where: | ||
|
||
- `path` is the path of the object to read. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not an object, it is a file. (Objects in IPFS are single IPLD nodes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I can see the terms seem to be used interchangeably. I've changed references to 'objects' to 'file', let me know if I've missed any..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, thank you!
552fde2
to
89af255
Compare
@achingbrain have you double checked that the tests conform to the SPEC? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please rebase and add these new functions to the new TOC at the top of the file?
SPEC/FILES.md
Outdated
|
||
##### `Go` **WIP** | ||
|
||
##### `JavaScript` - ipfs.files.readReadableStream(path, [options], [callback]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other stream based functions do not callback/promise, they return a stream. @diasdavid should these also for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That might make for a slightly nicer API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, @alanshaw is right. No need for using callbacks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the PR to not use callbacks/promises for streams.
License: MIT Signed-off-by: achingbrain <alex@achingbrain.net>
89af255
to
06668d2
Compare
@alanshaw I've rebased and updated the TOC. Is there something that could automate the TOC? |
Following on from this comment on ipfs-inactive/js-ipfs-mfs#1 this PR adds the stream related method signatures to the mfs spec.