Skip to content
This repository was archived by the owner on Apr 29, 2020. It is now read-only.

Commit 5a02421

Browse files
committed
chore: replace last few pull.* invocations with *
1 parent 03f58a8 commit 5a02421

File tree

4 files changed

+27
-20
lines changed

4 files changed

+27
-20
lines changed

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@
1919

2020
## Table of Contents
2121

22-
- [Install](#install)
23-
- [Usage](#usage)
24-
- [Example](#example)
25-
- [API](#api)
26-
- [const add = importer(dag, options)](#const-import--importerdag--options)
27-
- [Contribute](#contribute)
28-
- [License](#license)
22+
- [ipfs-unixfs-importer](#ipfs-unixfs-importer)
23+
- [Lead Maintainer](#lead-maintainer)
24+
- [Table of Contents](#table-of-contents)
25+
- [Install](#install)
26+
- [Usage](#usage)
27+
- [Example](#example)
28+
- [API](#api)
29+
- [const import = importer(dag [, options])](#const-import--importerdag--options)
30+
- [Contribute](#contribute)
31+
- [License](#license)
2932

3033
## Install
3134

@@ -50,11 +53,13 @@ And write the importing logic:
5053

5154
```js
5255
const importer = require('ipfs-unixfs-importer')
53-
const pull = require('pull-stream')
56+
const pull = require('pull-stream/pull')
57+
const values = require('pull-stream/sources/values')
58+
const collect = require('pull-stream/sinks/collect')
5459

5560
// Import path /tmp/foo/bar
5661
pull(
57-
pull.values([{
62+
values([{
5863
path: '/tmp/foo/bar',
5964
content: fs.createReadStream(file)
6065
}, {
@@ -68,7 +73,7 @@ pull(
6873
importer(<ipld-resolver instance>, <options>),
6974

7075
// Handle the error and do something with the results
71-
pull.collect((err, files) => {
76+
collect((err, files) => {
7277
console.info(files)
7378
})
7479
)

test/builder-dir-sharding.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('builder: directory sharding', function () {
4545
values([
4646
{
4747
path: 'a/b',
48-
content: pull.values([Buffer.from('i have the best bytes')])
48+
content: values([Buffer.from('i have the best bytes')])
4949
}
5050
]),
5151
importer(ipld, options),

test/import-export-nested-dir.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ describe('import and export: directory', () => {
3333

3434
pull(
3535
values([
36-
{ path: 'a/b/c/d/e', content: pull.values([Buffer.from('banana')]) },
37-
{ path: 'a/b/c/d/f', content: pull.values([Buffer.from('strawberry')]) },
38-
{ path: 'a/b/g', content: pull.values([Buffer.from('ice')]) },
39-
{ path: 'a/b/h', content: pull.values([Buffer.from('cream')]) }
36+
{ path: 'a/b/c/d/e', content: values([Buffer.from('banana')]) },
37+
{ path: 'a/b/c/d/f', content: values([Buffer.from('strawberry')]) },
38+
{ path: 'a/b/g', content: values([Buffer.from('ice')]) },
39+
{ path: 'a/b/h', content: values([Buffer.from('cream')]) }
4040
]),
4141
importer(ipld),
4242
collect((err, files) => {

test/importer.spec.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ chai.use(require('dirty-chai'))
1010
const expect = chai.expect
1111
const spy = require('sinon/lib/sinon/spy')
1212
const pull = require('pull-stream/pull')
13+
const empty = require('pull-stream/sources/empty')
1314
const once = require('pull-stream/sources/once')
1415
const values = require('pull-stream/sources/values')
1516
const collect = require('pull-stream/sinks/collect')
17+
const onEnd = require('pull-stream/sinks/on-end')
1618
const CID = require('cids')
1719
const IPLD = require('ipld')
1820
const loadFixture = require('aegir/fixtures')
@@ -153,7 +155,7 @@ const checkLeafNodeTypes = (ipld, options, expected, done) => {
153155
const checkNodeLinks = (ipld, options, expected, done) => {
154156
waterfall([
155157
(cb) => pull(
156-
pull.once({
158+
once({
157159
path: '/foo',
158160
content: Buffer.alloc(100).fill(1)
159161
}),
@@ -258,7 +260,7 @@ strategies.forEach((strategy) => {
258260
content: 'banana'
259261
}]),
260262
importer(ipld, options),
261-
pull.onEnd((err) => {
263+
onEnd((err) => {
262264
expect(err).to.exist()
263265
done()
264266
})
@@ -267,7 +269,7 @@ strategies.forEach((strategy) => {
267269

268270
it('doesn\'t yield anything on empty source', (done) => {
269271
pull(
270-
pull.empty(),
272+
empty(),
271273
importer(ipld, options),
272274
collect((err, nodes) => {
273275
expect(err).to.not.exist()
@@ -280,7 +282,7 @@ strategies.forEach((strategy) => {
280282
pull(
281283
values([{
282284
path: 'emptyfile',
283-
content: pull.empty()
285+
content: empty()
284286
}]),
285287
importer(ipld, options),
286288
collect((err, nodes) => {
@@ -306,7 +308,7 @@ strategies.forEach((strategy) => {
306308
}
307309
]),
308310
importer(ipld, options),
309-
pull.onEnd((err) => {
311+
onEnd((err) => {
310312
expect(err).to.exist()
311313
expect(err.message).to.be.eql('detected more than one root')
312314
done()

0 commit comments

Comments
 (0)