From 5d5f543c41acf736db8c3e3ae562075ee37910b8 Mon Sep 17 00:00:00 2001 From: smallnamespace Date: Thu, 9 Apr 2020 06:50:37 -0700 Subject: [PATCH] Fix https://github.com/lukeapage/pngjs/issues/129 (#130) --- lib/parser-async.js | 1 - test/png-parse-spec.js | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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"); + }); +});