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

Commit 89af255

Browse files
committed
docs: document mfs write content argument
1 parent 94801f1 commit 89af255

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

SPEC/FILES.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,8 @@ The Mutable File System (MFS) is a virtual file system on top of IPFS that expos
580580

581581
Where:
582582

583-
- `from` is the path of the source object to copy.
584-
- `to` is the path of the destination object to copy to.
583+
- `from` is the path of the source file to copy.
584+
- `to` is the path of the destination file to copy to.
585585

586586
`callback` must follow the `function (err) {}` signature, where `err` is an Error if the operation was not successful.
587587

@@ -681,7 +681,7 @@ ipfs.files.stat('/file.txt', (err, stats) => {
681681

682682
Where:
683683

684-
- `path` is the path of the object to remove.
684+
- `path` is the path of the file to remove.
685685
- `options` is an optional Object that might contain the following keys:
686686
- `recursive` is a Boolean value to decide whether or not to remove directories recursively.
687687

@@ -717,7 +717,7 @@ ipfs.files.rm('/my/beautiful/directory', { recursive: true }, (err) => {
717717

718718
Where:
719719

720-
- `path` is the path of the object to read.
720+
- `path` is the path of the file to read.
721721
- `options` is an optional Object that might contain the following keys:
722722
- `offset` is an Integer with the byte offset to begin reading from.
723723
- `count` is an Integer with the maximum number of bytes to read.
@@ -746,7 +746,7 @@ ipfs.files.read('/hello-world', (err, buf) => {
746746

747747
Where:
748748

749-
- `path` is the path of the object to read.
749+
- `path` is the path of the file to read.
750750
- `options` is an optional Object that might contain the following keys:
751751
- `offset` is an Integer with the byte offset to begin reading from.
752752
- `count` is an Integer with the maximum number of bytes to read.
@@ -771,11 +771,11 @@ ipfs.files.readReadableStream('/hello-world', (err, stream) => {
771771
772772
##### `Go` **WIP**
773773

774-
##### `JavaScript` - ipfs.files.readReadableStream(path, [options], [callback])
774+
##### `JavaScript` - ipfs.files.readPullStream(path, [options], [callback])
775775

776776
Where:
777777

778-
- `path` is the path of the object to read.
778+
- `path` is the path of the file to read.
779779
- `options` is an optional Object that might contain the following keys:
780780
- `offset` is an Integer with the byte offset to begin reading from.
781781
- `count` is an Integer with the maximum number of bytes to read.
@@ -808,10 +808,13 @@ ipfs.files.readPullStream('/hello-world', (err, stream) => {
808808

809809
Where:
810810

811-
- `path` is the path of the object to write.
811+
- `path` is the path of the file to write.
812812
- `content` can be:
813-
- a Buffer instance.
814-
- a Path (caveat: will only work in Node.js).
813+
- a [`Buffer`][b]
814+
- a [`PullStream`][ps]
815+
- a [`ReadableStream`][rs]
816+
- a [`Blob`][blob] (caveat: will only work in the browser)
817+
- a string path to a file (caveat: will only work in Node.js)
815818
- `options` is an optional Object that might contain the following keys:
816819
- `offset` is an Integer with the byte offset to begin writing at.
817820
- `create` is a Boolean to indicate to create the file if it doesn't exist.
@@ -840,8 +843,8 @@ ipfs.files.write('/hello-world', Buffer.from('Hello, world!'), (err) => {
840843

841844
Where:
842845

843-
- `from` is the path of the source object to move.
844-
- `to` is the path of the destination object to move to.
846+
- `from` is the path of the source file to move.
847+
- `to` is the path of the destination file to move to.
845848

846849
`callback` must follow the `function (err) {}` signature, where `err` is an Error if the operation was not successful.
847850

@@ -924,3 +927,4 @@ ipfs.files.ls('/screenshots', function (err, files) {
924927
[rs]: https://www.npmjs.com/package/readable-stream
925928
[ps]: https://www.npmjs.com/package/pull-stream
926929
[cid]: https://www.npmjs.com/package/cids
930+
[blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob

0 commit comments

Comments
 (0)