@@ -57,9 +57,44 @@ A valid (read: that follows this interface) IPFS core implementation, must expos
57
57
58
58
## Files
59
59
60
+ ### ` get `
61
+
62
+ > Get [ UnixFS] [ ] files from IPFS.
63
+
64
+ ##### ` Go ` ** WIP**
65
+
66
+ ##### ` JavaScript ` - ipfs.files.get(hash, [ callback] )
67
+
68
+ Where ` hash ` is an IPFS multiaddress or multihash.
69
+
70
+ ` callback ` must follow ` function (err, stream) {} ` signature, where ` err ` is an
71
+ error if the operation was not successful. ` stream ` will be a Readable stream,
72
+ outputting objects of the form
73
+
74
+ ``` js
75
+ {
76
+ path: ' /tmp/myfile.txt' ,
77
+ content: Readable stream
78
+ }
79
+ ```
80
+
81
+ If no ` callback ` is passed, a promise is returned with the Readable stream.
82
+
83
+ Example:
84
+
85
+ ``` js
86
+ ipfs .files .get (' QmQ2r6iMNpky5f1m4cnm3Yqw8VSvjuKpTcK1X7dBR1LkJF' , function (err , stream ) {
87
+ stream .on (' data' , (file ) => {
88
+ console .log (file .path )
89
+ file .content .pipe (process .stdout )
90
+ })
91
+ })
92
+ ```
93
+
94
+
60
95
### ` add `
61
96
62
- > Add files and data to IPFS.
97
+ > Add [ UnixFS ] [ ] files and data to IPFS.
63
98
64
99
##### ` Go ` ** WIP**
65
100
@@ -433,3 +468,4 @@ If no `callback` is passed, a [promise][] is returned.
433
468
[ DAGNode ] : https://github.com/vijayee/js-ipfs-merkle-dag
434
469
[ multihash ] : http://github.com/jbenet/multihash
435
470
[ promise ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
471
+ [ UnixFS ] : https://github.com/ipfs/specs/tree/master/unixfs
0 commit comments