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

Commit

Permalink
fix: return CIDs from files.flush (#1216)
Browse files Browse the repository at this point in the history
* fix: return CIDs from files.flush

* chore: remove gh url
  • Loading branch information
achingbrain authored Jan 11, 2020
1 parent ed43408 commit 13f8d7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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": "^0.127.0",
"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)
}
})

0 comments on commit 13f8d7a

Please sign in to comment.