StreamConv

Based on Borewit/readable-web-to-node-stream.

Example

Web streams to node stream

import Converter from "https://deno.land/x/streamconv/mod.ts";

const res = await fetch("https://mysite.com");

if (res.body) {
    const stream = Converter.WebToReadable(res.body); // Readable stream instance
    stream.on("data", chunk => console.log(chunk.toString()));
} else {
    console.log("no stream");
}

Node stream to web stream

import Converter from "https://deno.land/x/streamconv/mod.ts";

const res = await fetch("https://mysite.com");

if (res.body) {
    const stream = Converter.WebToReadable(res.body);
    const webstream = Converter.WebToReadable(stream); // web ReadableStream instance
} else {
    console.log("no stream");
}