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

feat: add files/flush #643

Merged
merged 2 commits into from
Dec 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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