Comparing version 2.0.1 to 2.1.0
@@ -24,2 +24,5 @@ /* | ||
this._last += this._decoder.write(chunk) | ||
if (this._last.length > this.maxLength) { | ||
return cb(new Error('maximum buffer reached')) | ||
} | ||
@@ -100,2 +103,3 @@ var list = this._last.split(this.matcher) | ||
stream.mapper = mapper | ||
stream.maxLength = options.maxLength | ||
@@ -102,0 +106,0 @@ return stream |
{ | ||
"name": "split2", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "split a Text Stream into a Line Stream, using Stream 3", | ||
@@ -26,3 +26,3 @@ "main": "index.js", | ||
"pre-commit": "^1.1.2", | ||
"standard": "^5.4.1", | ||
"standard": "^7.0.0", | ||
"tap": "^5.0.0" | ||
@@ -29,0 +29,0 @@ }, |
@@ -29,2 +29,5 @@ # Split2(matcher, mapper, options) | ||
Additionally, the `.maxLength` option is implemented, which will make the split stream throw an error | ||
if the buffer size exceeds `.maxLength`. | ||
Calling `.destroy` will make the stream emit `close`. Use this to perform cleanup logic | ||
@@ -31,0 +34,0 @@ |
13
test.js
@@ -286,1 +286,14 @@ 'use strict' | ||
}) | ||
test('maximum buffer limit', function (t) { | ||
t.plan(1) | ||
var input = split({ maxLength: 2 }) | ||
input.pipe(strcb(function (err, list) { | ||
t.ok(err) | ||
})) | ||
input.write('hey') | ||
}) | ||
Sorry, the diff of this file is not supported yet
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
13546
314
81