From 7dde056bbb110af6a10576b32fc580d429929682 Mon Sep 17 00:00:00 2001 From: Terren <11605395+terreng@users.noreply.github.com> Date: Sat, 13 Jul 2024 18:21:41 -0700 Subject: [PATCH] Fix to _flush make sure the stream ends correctly by pushing the final data --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 44cdec4..b368d80 100644 --- a/index.js +++ b/index.js @@ -75,7 +75,11 @@ class Encoder extends Transform { } _flush(callback) { - if (this.pending !== null) callback(null, this.encode(Buffer.alloc(0), true)); + if (this.pending !== null) { + this.push(this.encode(Buffer.alloc(0), true)); + this.pending = null; + } + callback(); } }