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

Commit b8904f1

Browse files
committed
docs: document mfs write content argument
1 parent 0f8c02d commit b8904f1

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
@@ -599,8 +599,8 @@ The Mutable File System (MFS) is a virtual file system on top of IPFS that expos
599599

600600
Where:
601601

602-
- `from` is the path of the source object to copy.
603-
- `to` is the path of the destination object to copy to.
602+
- `from` is the path of the source file to copy.
603+
- `to` is the path of the destination file to copy to.
604604

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

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

701701
Where:
702702

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

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

737737
Where:
738738

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

766766
Where:
767767

768-
- `path` is the path of the object to read.
768+
- `path` is the path of the file to read.
769769
- `options` is an optional Object that might contain the following keys:
770770
- `offset` is an Integer with the byte offset to begin reading from.
771771
- `count` is an Integer with the maximum number of bytes to read.
@@ -790,11 +790,11 @@ ipfs.files.readReadableStream('/hello-world', (err, stream) => {
790790
791791
##### `Go` **WIP**
792792

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

795795
Where:
796796

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

828828
Where:
829829

830-
- `path` is the path of the object to write.
830+
- `path` is the path of the file to write.
831831
- `content` can be:
832-
- a Buffer instance.
833-
- a Path (caveat: will only work in Node.js).
832+
- a [`Buffer`][b]
833+
- a [`PullStream`][ps]
834+
- a [`ReadableStream`][rs]
835+
- a [`Blob`][blob] (caveat: will only work in the browser)
836+
- a string path to a file (caveat: will only work in Node.js)
834837
- `options` is an optional Object that might contain the following keys:
835838
- `offset` is an Integer with the byte offset to begin writing at.
836839
- `create` is a Boolean to indicate to create the file if it doesn't exist.
@@ -859,8 +862,8 @@ ipfs.files.write('/hello-world', Buffer.from('Hello, world!'), (err) => {
859862

860863
Where:
861864

862-
- `from` is the path of the source object to move.
863-
- `to` is the path of the destination object to move to.
865+
- `from` is the path of the source file to move.
866+
- `to` is the path of the destination file to move to.
864867

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

@@ -943,3 +946,4 @@ ipfs.files.ls('/screenshots', function (err, files) {
943946
[rs]: https://www.npmjs.com/package/readable-stream
944947
[ps]: https://www.npmjs.com/package/pull-stream
945948
[cid]: https://www.npmjs.com/package/cids
949+
[blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob

0 commit comments

Comments
 (0)