From 13f8d7ae3510ef6a4156f3b947973549fb1b529f Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Sat, 11 Jan 2020 23:23:07 +0100 Subject: [PATCH] fix: return CIDs from files.flush (#1216) * fix: return CIDs from files.flush * chore: remove gh url --- package.json | 2 +- src/files/flush.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 901ca797f9..416066e328 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/files/flush.js b/src/files/flush.js index ab20623878..34e7258146 100644 --- a/src/files/flush.js +++ b/src/files/flush.js @@ -1,6 +1,7 @@ 'use strict' const configure = require('../lib/configure') +const CID = require('cids') module.exports = configure(({ ky }) => { return async (path, options) => { @@ -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) } })