diff --git a/package.json b/package.json index 68e288b..f76cc21 100644 --- a/package.json +++ b/package.json @@ -31,24 +31,24 @@ }, "homepage": "https://github.com/ipfs/js-ipfs-http-response#readme", "dependencies": { - "async": "^2.6.0", - "cids": "~0.5.5", - "debug": "^3.1.0", + "async": "^2.6.1", + "cids": "~0.5.7", + "debug": "^4.1.1", "file-type": "^8.0.0", "filesize": "^3.6.1", "get-stream": "^3.0.0", - "ipfs-unixfs": "~0.1.14", - "mime-types": "^2.1.18", - "multihashes": "~0.4.13", + "ipfs-unixfs": "~0.1.16", + "mime-types": "^2.1.21", + "multihashes": "~0.4.14", "promisify-es6": "^1.0.3", "stream-to-blob": "^1.0.1" }, "devDependencies": { - "aegir": "^13.1.0", - "chai": "^4.1.2", + "aegir": "^18.0.3", + "chai": "^4.2.0", "dirty-chai": "^2.0.1", - "ipfs": "~0.32.2", - "ipfsd-ctl": "~0.39.1" + "ipfs": "0.34.0", + "ipfsd-ctl": "~0.40.3" }, "contributors": [ "Alex Potsides ", diff --git a/src/index.js b/src/index.js index 0d084af..e3d96cb 100644 --- a/src/index.js +++ b/src/index.js @@ -62,7 +62,7 @@ const response = (ipfsNode, ipfsPath) => { resolver.cid(ipfsNode, ipfsPath) .then((resolvedData) => { - const readableStream = ipfsNode.files.catReadableStream(resolvedData.cid) + const readableStream = ipfsNode.catReadableStream(resolvedData.cid) const responseStream = new stream.PassThrough({ highWaterMark: 1 }) readableStream.pipe(responseStream) diff --git a/test/index.spec.js b/test/index.spec.js index 00084bd..d880d5e 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -35,13 +35,13 @@ describe('resolve file (CIDv0)', function () { ipfsd = _ipfsd ipfs = ipfsd.api - ipfs.files.add(file.data, {cidVersion: 0}, (err, filesAdded) => { + ipfs.add(file.data, { cidVersion: 0 }, (err, filesAdded) => { expect(err).to.not.exist() expect(filesAdded).to.have.length(1) const retrievedFile = filesAdded[0] expect(new CID(retrievedFile.hash)).to.deep.equal(new CID(file.cid)) - expect(retrievedFile.size, 'ipfs.files.add result size should not be smaller than input buffer').greaterThan(file.data.length) + expect(retrievedFile.size, 'ipfs.add result size should not be smaller than input buffer').greaterThan(file.data.length) done() }) @@ -79,12 +79,12 @@ describe('resolve file (CIDv1)', function () { ipfsd = _ipfsd ipfs = ipfsd.api - ipfs.files.add(file.data, {cidVersion: 1}, (err, filesAdded) => { + ipfs.add(file.data, { cidVersion: 1 }, (err, filesAdded) => { expect(err).to.not.exist() expect(filesAdded).to.have.length(1) const retrievedFile = filesAdded[0] expect(new CID(retrievedFile.hash)).to.deep.equal(new CID(file.cid)) - // expect(retrievedFile.size, 'ipfs.files.add result size should not be smaller than input buffer').greaterThan(file.data.length) + // expect(retrievedFile.size, 'ipfs.add result size should not be smaller than input buffer').greaterThan(file.data.length) done() }) @@ -135,15 +135,15 @@ describe('resolve directory (CIDv0)', function () { content('holmes.txt') ] - ipfs.files.add(dirs, {cidVersion: 0}, (err, res) => { + ipfs.add(dirs, { cidVersion: 0 }, (err, res) => { expect(err).to.not.exist() const root = res[res.length - 1] expect(root.path).to.equal('test-folder') expect(new CID(root.hash)).to.deep.equal(new CID(directory.cid)) - expect(res[0].size, 'ipfs.files.add 1st result size should not be smaller than 1st input buffer').greaterThan(dirs[0].content.length) - expect(res[1].size, 'ipfs.files.add 2nd result size should not be smaller than 2nd input buffer').greaterThan(dirs[1].content.length) + expect(res[0].size, 'ipfs.add 1st result size should not be smaller than 1st input buffer').greaterThan(dirs[0].content.length) + expect(res[1].size, 'ipfs.add 2nd result size should not be smaller than 2nd input buffer').greaterThan(dirs[1].content.length) done() }) @@ -207,7 +207,7 @@ describe('resolve directory (CIDv1)', function () { content('holmes.txt') ] - ipfs.files.add(dirs, {cidVersion: 1}, (err, res) => { + ipfs.add(dirs, { cidVersion: 1 }, (err, res) => { expect(err).to.not.exist() const root = res[res.length - 1] expect(root.path).to.equal('test-folder') @@ -278,7 +278,7 @@ describe('resolve web page (CIDv0)', function () { content('index.html') ] - ipfs.files.add(dirs, {cidVersion: 0}, (err, res) => { + ipfs.add(dirs, { cidVersion: 0 }, (err, res) => { expect(err).to.not.exist() const root = res[res.length - 1] @@ -330,7 +330,7 @@ describe('resolve web page (CIDv1)', function () { content('index.html') ] - ipfs.files.add(dirs, {cidVersion: 1}, (err, res) => { + ipfs.add(dirs, { cidVersion: 1 }, (err, res) => { expect(err).to.not.exist() const root = res[res.length - 1] expect(root.path).to.equal('test-site') @@ -386,7 +386,7 @@ describe('mime-types', () => { content('index.html') ] - ipfs.files.add(dirs, {cidVersion: 0}, (err, res) => { + ipfs.add(dirs, { cidVersion: 0 }, (err, res) => { expect(err).to.not.exist() const root = res[res.length - 1] diff --git a/test/resolver.spec.js b/test/resolver.spec.js index b0f237b..2567a86 100644 --- a/test/resolver.spec.js +++ b/test/resolver.spec.js @@ -32,7 +32,7 @@ describe('resolve file (CIDv0)', function () { ipfsd = _ipfsd ipfs = ipfsd.api - ipfs.files.add(file.data, {cidVersion: 0}, (err, filesAdded) => { + ipfs.add(file.data, { cidVersion: 0 }, (err, filesAdded) => { expect(err).to.not.exist() expect(filesAdded).to.have.length(1) @@ -81,7 +81,7 @@ describe('resolve file (CIDv1)', function () { ipfsd = _ipfsd ipfs = ipfsd.api - ipfs.files.add(file.data, {cidVersion: 1}, (err, filesAdded) => { + ipfs.add(file.data, { cidVersion: 1 }, (err, filesAdded) => { expect(err).to.not.exist() expect(filesAdded).to.have.length(1) // console.log('ipfs.files.add result', filesAdded) @@ -143,7 +143,7 @@ describe('resolve directory (CIDv0)', function () { content('holmes.txt') ] - ipfs.files.add(dirs, {cidVersion: 0}, (err, res) => { + ipfs.add(dirs, { cidVersion: 0 }, (err, res) => { expect(err).to.not.exist() const root = res[res.length - 1] @@ -201,7 +201,7 @@ describe('resolve directory (CIDv1)', function () { content('holmes.txt') ] - ipfs.files.add(dirs, {cidVersion: 1}, (err, res) => { + ipfs.add(dirs, { cidVersion: 1 }, (err, res) => { expect(err).to.not.exist() const root = res[res.length - 1] // console.log('ipfs.files.add result', res) @@ -264,7 +264,7 @@ describe('resolve web page (CIDv0)', function () { content('index.html') ] - ipfs.files.add(dirs, {cidVersion: 0}, (err, res) => { + ipfs.add(dirs, { cidVersion: 0 }, (err, res) => { expect(err).to.not.exist() const root = res[res.length - 1] @@ -326,7 +326,7 @@ describe('resolve web page (CIDv1)', function () { content('index.html') ] - ipfs.files.add(dirs, {cidVersion: 1}, (err, res) => { + ipfs.add(dirs, { cidVersion: 1 }, (err, res) => { expect(err).to.not.exist() // console.log(res) const root = res[res.length - 1]