Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
update get-dagNode for buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
nginnever committed Jun 17, 2016
1 parent 7af117d commit 0a154b6
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/get-dagnode.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ module.exports = function (send, hash, cb) {
var object = res[0]
var stream = res[1]

stream.pipe(bl(function (err, data) {
if (err) {
return cb(err)
}
if (Buffer.isBuffer(stream)) {
cb(err, new DAGNode(stream, object.Links))
} else {
stream.pipe(bl(function (err, data) {
if (err) {
return cb(err)
}

cb(err, new DAGNode(data, object.Links))
}))
cb(err, new DAGNode(data, object.Links))
}))
}
})
}

0 comments on commit 0a154b6

Please sign in to comment.