diff options
Diffstat (limited to 'ext/node/polyfills/internal/stream_base_commons.ts')
-rw-r--r-- | ext/node/polyfills/internal/stream_base_commons.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/node/polyfills/internal/stream_base_commons.ts b/ext/node/polyfills/internal/stream_base_commons.ts index d7acf729d..01da0c5e3 100644 --- a/ext/node/polyfills/internal/stream_base_commons.ts +++ b/ext/node/polyfills/internal/stream_base_commons.ts @@ -253,7 +253,9 @@ export function onStreamRead( } } else { const offset = streamBaseState[kArrayBufferOffset]; - const buf = Buffer.from(arrayBuffer, offset, nread); + // Performance note: Pass ArrayBuffer to Buffer#from to avoid + // copy. + const buf = Buffer.from(arrayBuffer.buffer, offset, nread); result = stream.push(buf); } |