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

Commit

Permalink
fix: update read cli to use returned pull stream
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: achingbrain <[email protected]>
  • Loading branch information
achingbrain committed Sep 26, 2018
1 parent 505cd6d commit 62cf0cd
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions src/cli/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const pull = require('pull-stream/pull')
const through = require('pull-stream/throughs/through')
const collect = require('pull-stream/sinks/collect')
const waterfall = require('async/waterfall')
const {
print
} = require('./utils')
Expand Down Expand Up @@ -36,27 +35,22 @@ module.exports = {

argv.resolve(
new Promise((resolve, reject) => {
waterfall([
(cb) => ipfs.files.readPullStream(path, {
pull(
ipfs.files.readPullStream(path, {
offset,
length
}, cb),
(stream, cb) => {
pull(
stream,
through(buffer => {
print(buffer, false)
}),
collect(cb)
)
}
], (error) => {
if (error) {
return reject(error)
}
}),
through(buffer => {
print(buffer, false)
}),
collect((error) => {
if (error) {
return reject(error)
}

resolve()
})
resolve()
})
)
})
)
}
Expand Down

0 comments on commit 62cf0cd

Please sign in to comment.