diff --git a/src/get-dagnode.js b/src/get-dagnode.js index 6e6982b72d..3d60844c95 100644 --- a/src/get-dagnode.js +++ b/src/get-dagnode.js @@ -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)) + })) + } }) }