diff --git a/package.json b/package.json index 6ffbd82..321c40d 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "interface-datastore": "~0.6.0", "ipfs-multipart": "~0.1.0", "ipfs-unixfs": "~0.1.16", - "ipfs-unixfs-exporter": "~0.35.5", + "ipfs-unixfs-exporter": "github:ipfs/js-ipfs-unixfs-exporter#refactor/export-cid-instances", "ipfs-unixfs-importer": "~0.38.0", "ipld-dag-pb": "~0.15.2", "is-pull-stream": "~0.0.0", diff --git a/src/core/ls-pull-stream.js b/src/core/ls-pull-stream.js index 7c94544..ba7e3b3 100644 --- a/src/core/ls-pull-stream.js +++ b/src/core/ls-pull-stream.js @@ -103,7 +103,7 @@ module.exports = (context) => { } loadNode(context, { - cid: file.hash + cid: file.cid }, (err, result) => { if (err) { return cb(err) @@ -114,7 +114,7 @@ module.exports = (context) => { cb(null, { name: file.name, type: FILE_TYPES[meta.type], - hash: formatCid(file.hash, options.cidBase), + hash: formatCid(file.cid, options.cidBase), size: meta.fileSize() || 0 }) }) diff --git a/src/core/mkdir.js b/src/core/mkdir.js index 555de42..534e72a 100644 --- a/src/core/mkdir.js +++ b/src/core/mkdir.js @@ -8,7 +8,6 @@ const pull = require('pull-stream/pull') const filter = require('pull-stream/throughs/filter') const map = require('pull-stream/throughs/map') const collect = require('pull-stream/sinks/collect') -const CID = require('cids') const { createNode, toMfsPath, @@ -88,7 +87,7 @@ module.exports = (context) => { exported = currentPath return { - cid: new CID(node.hash), + cid: node.cid, name: node.name } }), diff --git a/src/core/stat.js b/src/core/stat.js index 8dc4c98..a7a22ec 100644 --- a/src/core/stat.js +++ b/src/core/stat.js @@ -11,7 +11,6 @@ const pull = require('pull-stream/pull') const collect = require('pull-stream/sinks/collect') const asyncMap = require('pull-stream/throughs/async-map') const exporter = require('ipfs-unixfs-exporter') -const CID = require('cids') const log = require('debug')('ipfs:mfs:stat') const defaultOptions = { @@ -43,7 +42,7 @@ module.exports = (context) => { asyncMap((file, cb) => { if (options.hash) { return cb(null, { - hash: formatCid(new CID(file.hash), options.cidBase) + hash: formatCid(file.cid, options.cidBase) }) } @@ -54,7 +53,7 @@ module.exports = (context) => { } loadNode(context, { - cid: file.hash + cid: file.cid }, (err, result) => { if (err) { return cb(err) diff --git a/src/core/utils/to-trail.js b/src/core/utils/to-trail.js index 9e0fc5b..25a3c74 100644 --- a/src/core/utils/to-trail.js +++ b/src/core/utils/to-trail.js @@ -7,7 +7,6 @@ const filter = require('pull-stream/throughs/filter') const map = require('pull-stream/throughs/map') const collect = require('pull-stream/sinks/collect') const log = require('debug')('ipfs:mfs:utils:to-trail') -const CID = require('cids') const toTrail = (context, path, options, callback) => { const toExport = toPathComponents(path) @@ -57,7 +56,7 @@ const toTrail = (context, path, options, callback) => { return { name, - cid: new CID(node.hash), + cid: node.cid, size: node.size, type: node.type }