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

Commit 62cf0cd

Browse files
committed
fix: update read cli to use returned pull stream
License: MIT Signed-off-by: achingbrain <[email protected]>
1 parent 505cd6d commit 62cf0cd

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

src/cli/read.js

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
const pull = require('pull-stream/pull')
44
const through = require('pull-stream/throughs/through')
55
const collect = require('pull-stream/sinks/collect')
6-
const waterfall = require('async/waterfall')
76
const {
87
print
98
} = require('./utils')
@@ -36,27 +35,22 @@ module.exports = {
3635

3736
argv.resolve(
3837
new Promise((resolve, reject) => {
39-
waterfall([
40-
(cb) => ipfs.files.readPullStream(path, {
38+
pull(
39+
ipfs.files.readPullStream(path, {
4140
offset,
4241
length
43-
}, cb),
44-
(stream, cb) => {
45-
pull(
46-
stream,
47-
through(buffer => {
48-
print(buffer, false)
49-
}),
50-
collect(cb)
51-
)
52-
}
53-
], (error) => {
54-
if (error) {
55-
return reject(error)
56-
}
42+
}),
43+
through(buffer => {
44+
print(buffer, false)
45+
}),
46+
collect((error) => {
47+
if (error) {
48+
return reject(error)
49+
}
5750

58-
resolve()
59-
})
51+
resolve()
52+
})
53+
)
6054
})
6155
)
6256
}

0 commit comments

Comments
 (0)