You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
node:internal/structured_clone:23
channel.port1.postMessage(value, options?.transfer);
^
TypeError: Found invalid object in transferList
at structuredClone (node:internal/structured_clone:23:17)
at file:///.../streams.mjs:8:17
at ModuleJob.run (node:internal/modules/esm/module_job:194:25) {
code: 'ERR_INVALID_TRANSFER_OBJECT'
}
Node.js v19.3.0
This PR updates the ReadableStream constructor to mark byte streams as transferable. When transferred, byte streams become regular streams.
conststream=newReadableStream({type: "bytes",pull(controller){controller.enqueue(newUint8Array([1,2,3]));controller.close();},});conststream2=structuredClone(stream,{transfer: [stream]});constreader=awaitstream2.getReader();// `{ mode: "byob" }` would fail here as// `stream2` is no longer a byte stream
node:internal/structured_clone:23
channel.port1.postMessage(value, options?.transfer);
^
TypeError: Found invalid object in transferList
at structuredClone (node:internal/structured_clone:23:17)
at file:///.../streams.mjs:8:17
at ModuleJob.run (node:internal/modules/esm/module_job:194:25) {
code: 'ERR_INVALID_TRANSFER_OBJECT'
}
Node.js v19.3.0
This PR updates the ReadableStream constructor to mark byte streams as transferable. When transferred, byte streams become regular streams.
conststream=newReadableStream({type: "bytes",pull(controller){controller.enqueue(newUint8Array([1,2,3]));controller.close();},});conststream2=structuredClone(stream,{transfer: [stream]});constreader=awaitstream2.getReader();// `{ mode: "byob" }` would fail here as// `stream2` is no longer a byte stream
Previosuly, attempting to transfer a
type: "bytes"
ReadableStream
like so......would fail with...
This PR updates the
ReadableStream
constructor to mark byte streams as transferable. When transferred, byte streams become regular streams.(tested with Chrome 108.0.5359.124)
Refs: nodejs/node#39062
Refs: https://streams.spec.whatwg.org/#rs-transfer
Originally posted by @mrbbot in nodejs/node#45955
The text was updated successfully, but these errors were encountered: