Using stream.Readable.fromWeb(readableStream[, options])
one can convert a Web API ReadableStream
to a Node.js stream.Readable
.
The following code example illustrates how to do that:
const { Readable } = require('node:stream');
// Assuming you have a Web API ReadableStream named webReadableStream
const nodeReadable = Readable.fromWeb(webReadableStream);
});
This function is available since Node.js version 17, but at the time of writing, in the most recent version of Node.js version 23, but only available as an experimental function (not available by default).