From d9fbab1aead95df2227a04b145fcc6ea2639dc4c Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Sun, 22 Sep 2019 15:20:43 +0100 Subject: [PATCH] WIP 6 --- lib/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/index.js b/lib/index.js index 6d5f203..8a04f0e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -229,6 +229,13 @@ class ChopStream extends Writable { chunk = buffers[index]; chunkEnd = chunkStart + chunk.length; } + + // Call `._write()`'s callback if have streamed out all received + const cb = this._writeCb; + if (cb && chunkEnd === this._position) { + this._writeCb(null); + this._writeCb = null; + } } /**