import { collect } from "https://deno.land/x/streamtools@v1.0.0/collect.ts";
Reads all chunks from a readable stream and returns them as an array of chunks.
import { collect } from "./collect.ts";
const reader = new ReadableStream<number>({
start(controller) {
controller.enqueue(1);
controller.enqueue(2);
controller.enqueue(3);
controller.close();
},
});
console.log(await collect(reader)); // [1, 2, 3]