Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! zlib: avoid converting Uint8Array instances to Buffer
  • Loading branch information
aduh95 committed Jul 23, 2021
commit 22a8376f4a1508acac403891e85602a1b9a19e79
9 changes: 1 addition & 8 deletions lib/zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ const {
ReflectApply,
StringPrototypeStartsWith,
Symbol,
TypedArrayPrototypeGetBuffer,
TypedArrayPrototypeGetByteLength,
TypedArrayPrototypeGetByteOffset,
TypedArrayPrototypeFill,
Uint32Array,
} = primordials;
Expand Down Expand Up @@ -118,11 +115,7 @@ function zlibBuffer(engine, buffer, callback) {
// Streams do not support non-Uint8Array ArrayBufferViews yet. Convert it to a
// Buffer without copying.
if (isArrayBufferView(buffer) && !isUint8Array(buffer)) {
buffer = Buffer.from(
TypedArrayPrototypeGetBuffer(buffer),
TypedArrayPrototypeGetByteOffset(buffer),
TypedArrayPrototypeGetByteLength(buffer)
);
buffer = Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength);
} else if (isAnyArrayBuffer(buffer)) {
buffer = Buffer.from(buffer);
}
Expand Down