Comparing version 0.4.1 to 0.4.2
@@ -56,3 +56,5 @@ const DuplexStream = require('stream').DuplexStream || require('readable-stream/duplex') | ||
BufferList.prototype.end = function () { | ||
BufferList.prototype.end = function (chunk) { | ||
DuplexStream.prototype.end.call(this, chunk) | ||
if (this._callback) | ||
@@ -156,2 +158,2 @@ this._callback(null, this.slice()) | ||
module.exports = BufferList | ||
module.exports = BufferList |
{ | ||
"name" : "bl" | ||
, "version" : "0.4.1" | ||
, "version" : "0.4.2" | ||
, "description" : "Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!" | ||
@@ -16,2 +16,3 @@ , "main" : "bl.js" | ||
"Rod Vagg <rod@vagg.org> (https://github.com/rvagg)" | ||
, "Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)" | ||
] | ||
@@ -32,2 +33,2 @@ , "keywords" : [ | ||
} | ||
} | ||
} |
@@ -156,4 +156,11 @@ # bl *(BufferList)* | ||
## Contributors | ||
**bl** is brought to you by the following hackers: | ||
* [Rod Vagg](https://github.com/rvagg) | ||
* [Matteo Collina](https://github.com/mcollina) | ||
## License | ||
**bl** is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. | ||
**bl** is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. |
36
test.js
@@ -321,1 +321,37 @@ const tape = require('tape') | ||
}) | ||
tape('write nothing, should get empty buffer', function (t) { | ||
t.plan(3) | ||
BufferList(function (err, data) { | ||
t.notOk(err, 'no error') | ||
t.ok(Buffer.isBuffer(data), 'got a buffer') | ||
t.equal(0, data.length, 'got a zero-length buffer') | ||
t.end() | ||
}).end() | ||
}) | ||
tape('unicode string', function (t) { | ||
t.plan(2) | ||
var inp1 = '\u2600' | ||
, inp2 = '\u2603' | ||
, exp = inp1 + ' and ' + inp2 | ||
, bl = BufferList() | ||
bl.write(inp1) | ||
bl.write(' and ') | ||
bl.write(inp2) | ||
t.equal(exp, bl.toString()) | ||
t.equal(new Buffer(exp).toString('hex'), bl.toString('hex')) | ||
}) | ||
tape('should emit finish', function (t) { | ||
var source = BufferList() | ||
, dest = BufferList() | ||
source.write('hello') | ||
source.pipe(dest) | ||
dest.on('finish', function () { | ||
t.equal(dest.toString('utf8'), 'hello') | ||
t.end() | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24980
417
166