stream: add primordials to adapters

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Yagiz Nizipli authored and Ruy Adorno committed 2022-11-21 15:20:47 -05:00
1 parent 5274a8f7db
commit c00258e24b
1 file changed
+11 -6
+11 -6
View File
@@ -5,6 +5,9 @@ const {
PromiseResolve,
SafePromiseAll,
SafePromisePrototypeFinally,
TypedArrayPrototypeGetBuffer,
TypedArrayPrototypeGetByteOffset,
TypedArrayPrototypeGetByteLength,
Uint8Array,
} = primordials;
@@ -267,9 +270,10 @@ function newStreamWritableFromWritableStream(writableStream, options = kEmptyObj
} else {
chunk = Buffer.from(chunk, encoding);
chunk = new Uint8Array(
chunk.buffer,
chunk.byteOffset,
chunk.byteLength);
TypedArrayPrototypeGetBuffer(chunk),
TypedArrayPrototypeGetByteOffset(chunk),
TypedArrayPrototypeGetByteLength(chunk),
);
}
}
@@ -692,9 +696,10 @@ function newStreamDuplexFromReadableWritablePair(pair = kEmptyObject, options =
} else {
chunk = Buffer.from(chunk, encoding);
chunk = new Uint8Array(
chunk.buffer,
chunk.byteOffset,
chunk.byteLength);
TypedArrayPrototypeGetBuffer(chunk),
TypedArrayPrototypeGetByteOffset(chunk),
TypedArrayPrototypeGetByteLength(chunk),
);
}
}