aha, sure - this example was when you have a deno stream you want to stream to a node stream. The result indeed has to be converted back.
I can share our attempt, its indeed not perfect:
export function toDenoReadableStream(stream: Readable): ReadableStream<Uint8Array> {
return new ReadableStream({
start(controller) {
stream.on("data", (chunk) => {
controller.enqueue(chunk);
});
stream.on("error", (err) => {
// logger.error(err);
controller.error(err);
});
stream.on("end", () => {
try {
// Interacting with the controller if already "closed" will throw an error