diff options
Diffstat (limited to '')
-rw-r--r-- | src/bun.js/streams.exports.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/bun.js/streams.exports.js b/src/bun.js/streams.exports.js index 4e812437e..7e52312ad 100644 --- a/src/bun.js/streams.exports.js +++ b/src/bun.js/streams.exports.js @@ -5786,7 +5786,7 @@ function createNativeStream(nativeType, Readable) { #handleResult(result, view, isClosed) { if (typeof result === "number") { - if (result >= this.#highWaterMark && !this.#hasResized) { + if (result >= this.#highWaterMark && !this.#hasResized && !isClosed) { this.#highWaterMark *= 2; this.#hasResized = true; } @@ -5796,7 +5796,11 @@ function createNativeStream(nativeType, Readable) { this.push(null); return view?.byteLength ?? 0 > 0 ? view : undefined; } else if (ArrayBuffer.isView(result)) { - if (result.byteLength >= this.#highWaterMark && !this.#hasResized) { + if ( + result.byteLength >= this.#highWaterMark && + !this.#hasResized && + !isClosed + ) { this.#highWaterMark *= 2; this.#hasResized = true; } |