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

Commit 0a154b6

Browse files
committed
update get-dagNode for buffers
1 parent 7af117d commit 0a154b6

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/get-dagnode.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,16 @@ module.exports = function (send, hash, cb) {
2727
var object = res[0]
2828
var stream = res[1]
2929

30-
stream.pipe(bl(function (err, data) {
31-
if (err) {
32-
return cb(err)
33-
}
30+
if (Buffer.isBuffer(stream)) {
31+
cb(err, new DAGNode(stream, object.Links))
32+
} else {
33+
stream.pipe(bl(function (err, data) {
34+
if (err) {
35+
return cb(err)
36+
}
3437

35-
cb(err, new DAGNode(data, object.Links))
36-
}))
38+
cb(err, new DAGNode(data, object.Links))
39+
}))
40+
}
3741
})
3842
}

0 commit comments

Comments
 (0)