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 committed Feb 10, 2016
1 parent f443c82 commit 0bd6c46
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bl.js
Original file line number Diff line number Diff line change
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 = this._bufs.concat(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 0bd6c46

Please sign in to comment.