mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
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:
1 parent
5274a8f7db
commit
c00258e24b
1 file changed
+11
-6
@@ -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),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user