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

Commit

Permalink
feat: add files/flush (#643)
Browse files Browse the repository at this point in the history
* add flush

* add test and readme
  • Loading branch information
hacdias authored and daviddias committed Dec 14, 2017
1 parent 0ef587a commit 5c254eb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ $ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "[\"PUT\", \"P
- [`ipfs.files.get(hash, [callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/SPEC/FILES.md#get)
- alias to `ipfs.get`
- `ipfs.ls`
- `ipfs.files.flush(path, [callback])`
- mfs (mutable file system) specific:
- `ipfs.files.cp`
- `ipfs.files.ls`
Expand Down
12 changes: 12 additions & 0 deletions src/files/flush.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict'

const promisify = require('promisify-es6')

module.exports = (send) => {
return promisify((args, callback) => {
return send({
path: 'files/flush',
args: args
}, callback)
})
}
1 change: 1 addition & 0 deletions src/files/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = (arg) => {
get: require('./get')(send),
getReadableStream: require('./get-readable-stream')(send),
getPullStream: require('./get-pull-stream')(send),
flush: require('./flush')(send),

// Specific to MFS (for now)
cp: require('./cp')(send),
Expand Down
4 changes: 4 additions & 0 deletions test/files.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ describe('.files (the MFS API part)', function () {
ipfs.files.mkdir('/test-folder', done)
})

it('files.flush', (done) => {
ipfs.files.flush('/', done)
})

it('files.cp', (done) => {
ipfs.files.cp([
'/ipfs/Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP',
Expand Down

0 comments on commit 5c254eb

Please sign in to comment.