From 0980f9d90b11d786e03e77c63c065ff109aae21e Mon Sep 17 00:00:00 2001 From: tsctx <91457664+tsctx@users.noreply.github.com> Date: Wed, 15 May 2024 16:43:18 +0900 Subject: [PATCH] perf: avoid buffer cloning (#3264) --- lib/web/fetch/body.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/fetch/body.js b/lib/web/fetch/body.js index 0f4ef04d2fe..5b14d22d27a 100644 --- a/lib/web/fetch/body.js +++ b/lib/web/fetch/body.js @@ -392,7 +392,7 @@ function bodyMixinMethods (instance) { // with this and the following step given a byte sequence bytes: return the // result of creating a Uint8Array from bytes in this’s relevant realm. return consumeBody(this, (bytes) => { - return new Uint8Array(bytes) + return new Uint8Array(bytes.buffer, 0, bytes.byteLength) }, instance, true) } }