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
However, when trying to construct a ReadableStream
let z = 0;
const readable = new globalThis.ReadableStream({
pull(c) {
if (z === 5) {
c.close();
}
c.enqueue(new Uint8Array([z]));
++z;
}
});
this error is thrown
[class: ReadableStream]
Error: ReadableStream is not supported via global scope. Enable this by adding this to your code:
import { ReadableStream } from "stream";
globalThis.ReadableStream = ReadableStream;
Node.js Readable is not the same as WHATWG ReadableStream, and is not exported by "node:stream"
import * as streams from "node:stream";
console.log(streams);
Duplex.toWeb() does convert a Node.js-specific Readable to a WHATWG ReadableStream. We shouldn't need to do that if WHATWG ReadableStream is defined globally.
This needs clarifying.
The text was updated successfully, but these errors were encountered:
If the real WHATWG ReadableStream is not implemented it probably shouldn't be exposed, especially if the class is exposed, yet the runtime claims it's not a global. Doesn't make sense, to me.
For disambiguity, what I'm referring to herein is WHATWG
ReadableStream
https://streams.spec.whatwg.org/#rs-class, not Node.js-specificReadable
When you do this
this is printed
However, when trying to construct a
ReadableStream
this error is thrown
Node.js
Readable
is not the same as WHATWGReadableStream
, and is not exported by"node:stream"
Duplex.toWeb()
does convert a Node.js-specificReadable
to a WHATWGReadableStream
. We shouldn't need to do that if WHATWGReadableStream
is defined globally.This needs clarifying.
The text was updated successfully, but these errors were encountered: