Skip to content

Commit

Permalink
Link internal buffers in append()
Browse files Browse the repository at this point in the history
This provides support for node v5.6.0.

Fixes #26.
  • Loading branch information
mcollina authored and rvagg committed Feb 11, 2016
1 parent c5d4788 commit 79feb5b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bl.js
Expand Up @@ -57,8 +57,14 @@ BufferList.prototype.append = function (buf) {
if (typeof buf == 'number')
buf = buf.toString()

this._bufs.push(isBuffer ? buf : new Buffer(buf))
this.length += buf.length
if (buf instanceof BufferList) {
this._bufs.push.apply(this._bufs, buf._bufs)
this.length += buf.length
} else {
this._bufs.push(isBuffer ? buf : new Buffer(buf))
this.length += buf.length
}

return this
}

Expand Down

0 comments on commit 79feb5b

Please sign in to comment.