diff --git a/lib/parser-async.js b/lib/parser-async.js index 9c27353..4ff599a 100644 --- a/lib/parser-async.js +++ b/lib/parser-async.js @@ -140,7 +140,6 @@ ParserAsync.prototype._finished = function() { // no more data to inflate this._inflate.end(); } - this.destroySoon(); }; ParserAsync.prototype._complete = function(filteredData) { diff --git a/test/png-parse-spec.js b/test/png-parse-spec.js index 8853742..ad9365a 100644 --- a/test/png-parse-spec.js +++ b/test/png-parse-spec.js @@ -346,3 +346,15 @@ test("should set alpha=true in metadata for images with tRNS chunk", function (t t.end(); }); }); + +test("Should parse with low highWaterMark", function (t) { + fs.createReadStream(path.join(__dirname, "in", "tbbn0g04.png"), { highWaterMark: 2 }) + .pipe(new PNG()) + .on('parsed', function () { + t.pass("Image should have parsed"); + t.end(); + }) + .on('error', function (e) { + t.error(e, "Should not error"); + }); +});