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

Commit 774a51e

Browse files
committed
add readme documentation for files
1 parent 082ec66 commit 774a51e

File tree

1 file changed

+34
-13
lines changed

1 file changed

+34
-13
lines changed

README.md

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -222,33 +222,54 @@ curl 'http://localhost:5001/api/v0/object/get?arg=QmYEqnfCZp7a39Gxrgyv3qRS4MoCTG
222222

223223
##### mkdir
224224

225-
bash:
226-
`curl "http://localhost:5001/api/v0/files/mkdir?arg=%2F<folder name>`"
227-
228-
response: (it returns empty when successful)
229-
```
230-
```
231-
232-
javascript:
233225
```JavaScript
234226
ipfs.files.mkdir(<folderName>, function (err) {})
235227
```
236228

237-
response: (it returns empty when successful)
238-
```
239-
```
240-
241229
##### cp
242230

231+
```JavaScript
232+
ipfs.files.cp([<pathSrc>, <pathDst>], function (err) {})
233+
```
234+
243235
##### ls
244236

237+
```JavaScript
238+
ipfs.files.ls(<path>, function (err, res) {})
239+
```
240+
245241
##### stat
246242

243+
```JavaScript
244+
ipfs.files.stat(<path>, function (err, res) {})
245+
```
246+
247247
##### rm
248248

249+
```JavaScript
250+
ipfs.files.rm(<path>, [<options>], function (err) {})
251+
```
252+
253+
For `rm -r` pass a options obj with `r: true`
254+
249255
##### read
250256

257+
```JavaScript
258+
ipfs.files.read(<path>, function (err, res) {
259+
if(res.readable) {
260+
// Returned as a stream
261+
res.pipe(process.stdout)
262+
} else {
263+
// Returned as a string
264+
console.log(res)
265+
}
266+
})
267+
```
268+
251269
##### write
252270

253271
##### mv
254-
curl "http://localhost:5001/api/v0/files/mkdir?arg=%2Ffolder4"
272+
273+
```JavaScript
274+
ipfs.files.mv([<pathSrc>, <pathDst>], function (err) {})
275+
```

0 commit comments

Comments
 (0)