From 4ccf43a4e749af21876bd15765c7403730c1393f Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Tue, 3 Jan 2023 12:01:11 -0500 Subject: [PATCH] lib: improve performance of readable webstreams --- lib/internal/streams/readable.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/internal/streams/readable.js b/lib/internal/streams/readable.js index aad4c594501ba6..caf41c3f424ace 100644 --- a/lib/internal/streams/readable.js +++ b/lib/internal/streams/readable.js @@ -260,7 +260,9 @@ function readableAddChunk(stream, chunk, encoding, addToFront) { } else if (chunk instanceof Buffer) { encoding = ''; } else if (Stream._isUint8Array(chunk)) { - chunk = Stream._uint8ArrayToBuffer(chunk); + if (!state.decoder) { + chunk = Stream._uint8ArrayToBuffer(chunk); + } encoding = ''; } else if (chunk != null) { err = new ERR_INVALID_ARG_TYPE(