diff --git a/README.md b/README.md index 4d58abdf..cbf62cb7 100644 --- a/README.md +++ b/README.md @@ -50,11 +50,13 @@ And write the importing logic: ```js const importer = require('ipfs-unixfs-importer') -const pull = require('pull-stream') +const pull = require('pull-stream/pull') +const values = require('pull-stream/sources/values') +const collect = require('pull-stream/sinks/collect') // Import path /tmp/foo/bar pull( - pull.values([{ + values([{ path: '/tmp/foo/bar', content: fs.createReadStream(file) }, { @@ -68,7 +70,7 @@ pull( importer(, ), // Handle the error and do something with the results - pull.collect((err, files) => { + collect((err, files) => { console.info(files) }) ) diff --git a/test/builder-dir-sharding.spec.js b/test/builder-dir-sharding.spec.js index 015da467..7aa22697 100644 --- a/test/builder-dir-sharding.spec.js +++ b/test/builder-dir-sharding.spec.js @@ -45,7 +45,7 @@ describe('builder: directory sharding', function () { values([ { path: 'a/b', - content: pull.values([Buffer.from('i have the best bytes')]) + content: values([Buffer.from('i have the best bytes')]) } ]), importer(ipld, options), diff --git a/test/import-export-nested-dir.spec.js b/test/import-export-nested-dir.spec.js index ec54cecf..3bc237c7 100644 --- a/test/import-export-nested-dir.spec.js +++ b/test/import-export-nested-dir.spec.js @@ -33,10 +33,10 @@ describe('import and export: directory', () => { pull( values([ - { path: 'a/b/c/d/e', content: pull.values([Buffer.from('banana')]) }, - { path: 'a/b/c/d/f', content: pull.values([Buffer.from('strawberry')]) }, - { path: 'a/b/g', content: pull.values([Buffer.from('ice')]) }, - { path: 'a/b/h', content: pull.values([Buffer.from('cream')]) } + { path: 'a/b/c/d/e', content: values([Buffer.from('banana')]) }, + { path: 'a/b/c/d/f', content: values([Buffer.from('strawberry')]) }, + { path: 'a/b/g', content: values([Buffer.from('ice')]) }, + { path: 'a/b/h', content: values([Buffer.from('cream')]) } ]), importer(ipld), collect((err, files) => { diff --git a/test/importer.spec.js b/test/importer.spec.js index f92f4192..596d69dd 100644 --- a/test/importer.spec.js +++ b/test/importer.spec.js @@ -10,9 +10,11 @@ chai.use(require('dirty-chai')) const expect = chai.expect const spy = require('sinon/lib/sinon/spy') const pull = require('pull-stream/pull') +const empty = require('pull-stream/sources/empty') const once = require('pull-stream/sources/once') const values = require('pull-stream/sources/values') const collect = require('pull-stream/sinks/collect') +const onEnd = require('pull-stream/sinks/on-end') const CID = require('cids') const IPLD = require('ipld') const loadFixture = require('aegir/fixtures') @@ -153,7 +155,7 @@ const checkLeafNodeTypes = (ipld, options, expected, done) => { const checkNodeLinks = (ipld, options, expected, done) => { waterfall([ (cb) => pull( - pull.once({ + once({ path: '/foo', content: Buffer.alloc(100).fill(1) }), @@ -258,7 +260,7 @@ strategies.forEach((strategy) => { content: 'banana' }]), importer(ipld, options), - pull.onEnd((err) => { + onEnd((err) => { expect(err).to.exist() done() }) @@ -267,7 +269,7 @@ strategies.forEach((strategy) => { it('doesn\'t yield anything on empty source', (done) => { pull( - pull.empty(), + empty(), importer(ipld, options), collect((err, nodes) => { expect(err).to.not.exist() @@ -280,7 +282,7 @@ strategies.forEach((strategy) => { pull( values([{ path: 'emptyfile', - content: pull.empty() + content: empty() }]), importer(ipld, options), collect((err, nodes) => { @@ -306,7 +308,7 @@ strategies.forEach((strategy) => { } ]), importer(ipld, options), - pull.onEnd((err) => { + onEnd((err) => { expect(err).to.exist() expect(err.message).to.be.eql('detected more than one root') done()