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; + } } /**