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

docs: adds stream-related mfs files.read method signatures #265

Merged
merged 3 commits into from
May 15, 2018

Conversation

achingbrain
Copy link
Collaborator

Following on from this comment on ipfs-inactive/js-ipfs-mfs#1 this PR adds the stream related method signatures to the mfs spec.

SPEC/FILES.md Outdated

##### `Go` **WIP**

##### `JavaScript` - ipfs.files.readReadableStream(path, [options], [callback])
Copy link
Contributor

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

Copy link
Collaborator Author

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].
Copy link
Contributor

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?

Copy link
Collaborator Author

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.
Copy link
Contributor

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)

Copy link
Collaborator Author

@achingbrain achingbrain May 14, 2018

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..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, thank you!

@achingbrain achingbrain force-pushed the add-mfs-read-methods branch from 552fde2 to 89af255 Compare May 14, 2018 12:14
@daviddias
Copy link
Contributor

@achingbrain have you double checked that the tests conform to the SPEC?

Copy link
Contributor

@alanshaw alanshaw left a 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])
Copy link
Contributor

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?

Copy link
Collaborator Author

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

Copy link
Contributor

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.

Copy link
Collaborator Author

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.

@achingbrain achingbrain force-pushed the add-mfs-read-methods branch from 89af255 to 06668d2 Compare May 15, 2018 13:14
@achingbrain
Copy link
Collaborator Author

@alanshaw I've rebased and updated the TOC. Is there something that could automate the TOC?

@alanshaw alanshaw merged commit 31ec91f into master May 15, 2018
@ghost ghost removed the in progress label May 15, 2018
@alanshaw alanshaw deleted the add-mfs-read-methods branch May 15, 2018 16:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants