Skip to content

Commit c00258e

Browse files
anonrigruyadorno
authored andcommitted
stream: add primordials to adapters
PR-URL: #45511 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 5274a8f commit c00258e

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

lib/internal/webstreams/adapters.js

+11-6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ const {
55
PromiseResolve,
66
SafePromiseAll,
77
SafePromisePrototypeFinally,
8+
TypedArrayPrototypeGetBuffer,
9+
TypedArrayPrototypeGetByteOffset,
10+
TypedArrayPrototypeGetByteLength,
811
Uint8Array,
912
} = primordials;
1013

@@ -267,9 +270,10 @@ function newStreamWritableFromWritableStream(writableStream, options = kEmptyObj
267270
} else {
268271
chunk = Buffer.from(chunk, encoding);
269272
chunk = new Uint8Array(
270-
chunk.buffer,
271-
chunk.byteOffset,
272-
chunk.byteLength);
273+
TypedArrayPrototypeGetBuffer(chunk),
274+
TypedArrayPrototypeGetByteOffset(chunk),
275+
TypedArrayPrototypeGetByteLength(chunk),
276+
);
273277
}
274278
}
275279

@@ -692,9 +696,10 @@ function newStreamDuplexFromReadableWritablePair(pair = kEmptyObject, options =
692696
} else {
693697
chunk = Buffer.from(chunk, encoding);
694698
chunk = new Uint8Array(
695-
chunk.buffer,
696-
chunk.byteOffset,
697-
chunk.byteLength);
699+
TypedArrayPrototypeGetBuffer(chunk),
700+
TypedArrayPrototypeGetByteOffset(chunk),
701+
TypedArrayPrototypeGetByteLength(chunk),
702+
);
698703
}
699704
}
700705

0 commit comments

Comments
 (0)