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

fix: return CIDs from files.flush #1216

Merged
merged 2 commits into from
Jan 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"cross-env": "^6.0.0",
"detect-node": "^2.0.4",
"go-ipfs-dep": "^0.4.22",
"interface-ipfs-core": "^0.126.0",
"interface-ipfs-core": "ipfs/interface-js-ipfs-core#update-mfs-flush",
"ipfsd-ctl": "^1.0.0",
"ndjson": "^1.5.0",
"nock": "^11.4.0",
Expand Down
7 changes: 5 additions & 2 deletions src/files/flush.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'

const configure = require('../lib/configure')
const CID = require('cids')

module.exports = configure(({ ky }) => {
return async (path, options) => {
Expand All @@ -14,11 +15,13 @@ module.exports = configure(({ ky }) => {
const searchParams = new URLSearchParams(options.searchParams)
searchParams.set('arg', path)

await ky.post('files/flush', {
const res = await ky.post('files/flush', {
timeout: options.timeout,
signal: options.signal,
headers: options.headers,
searchParams
}).text()
}).json()

return new CID(res.Cid)
}
})