From 57caad4450d241207066ca3832fb8e9095ad402f Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 10 Feb 2021 19:32:36 -0800 Subject: [PATCH] small perf improvement --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 7a0e9c2..cc19926 100644 --- a/index.js +++ b/index.js @@ -410,7 +410,9 @@ Buffer.concat = function concat (list, length) { let buf = list[i] if (isInstance(buf, Uint8Array)) { if (pos + buf.length > buffer.length) { - if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf) + if (!Buffer.isBuffer(buf)) { + buf = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) + } buf.copy(buffer, pos) } else { Uint8Array.prototype.set.call( -- 2.34.1