diff --git a/src/core/components/files-mfs.js b/src/core/components/files-mfs.js index 2fd44d2979..e42e495b30 100644 --- a/src/core/components/files-mfs.js +++ b/src/core/components/files-mfs.js @@ -3,38 +3,37 @@ const promisify = require('promisify-es6') const mfs = require('ipfs-mfs/core') -module.exports = self => { - const mfsSelf = Object.assign({}, self) - - // A patched dag API to ensure preload doesn't happen for MFS operations - // (MFS is preloaded periodically) - mfsSelf.dag = Object.assign({}, self.dag, { - get: promisify((cid, path, opts, cb) => { - if (typeof path === 'function') { - cb = path - path = undefined - } - - if (typeof opts === 'function') { - cb = opts - opts = {} - } - - opts = Object.assign({}, opts, { preload: false }) - - return self.dag.get(cid, path, opts, cb) - }), - put: promisify((node, opts, cb) => { - if (typeof opts === 'function') { - cb = opts - opts = {} - } - - opts = Object.assign({}, opts, { preload: false }) - - return self.dag.put(node, opts, cb) - }) - }) - - return mfs(mfsSelf, mfsSelf._options) +module.exports = (self) => { + const proxy = { + add: self.add, + dag: { + get: promisify((cid, path, opts, cb) => { + if (typeof path === 'function') { + cb = path + path = undefined + } + + if (typeof opts === 'function') { + cb = opts + opts = {} + } + + opts = Object.assign({}, opts, { preload: false }) + + return self.dag.get(cid, path, opts, cb) + }), + put: promisify((node, opts, cb) => { + if (typeof opts === 'function') { + cb = opts + opts = {} + } + + opts = Object.assign({}, opts, { preload: false }) + + return self.dag.put(node, opts, cb) + }) + } + } + + return mfs(proxy, self._options) } diff --git a/test/core/files.spec.js b/test/core/files.spec.js index 77f99739ca..d1c6e96662 100644 --- a/test/core/files.spec.js +++ b/test/core/files.spec.js @@ -11,7 +11,7 @@ const pull = require('pull-stream') const IPFSFactory = require('ipfsd-ctl') const IPFS = require('../../src/core') -describe('files', () => { +describe.only('files', () => { let ipfsd, ipfs before(function (done) {