std/streams
2022-10-03 20:09:52 +09:00
..
buffer_test.ts feat(streams): LimitedTransformStream & LimitedBytesTransformStream (#2007) 2022-03-07 17:47:06 +01:00
buffer.ts chore: remove void and Promise<void> return types (#2550) 2022-08-24 10:21:57 +09:00
conversion_test.ts fix(streams): don't use shared buffer for iterateReader outputs (#2735) 2022-10-03 20:09:52 +09:00
conversion.ts fix(streams): don't use shared buffer for iterateReader outputs (#2735) 2022-10-03 20:09:52 +09:00
delimiter_test.ts chore: remove deprecated APIs across collections, streams, textproto and uuid (#2720) 2022-09-30 16:27:11 +09:00
delimiter.ts chore: remove deprecated APIs across collections, streams, textproto and uuid (#2720) 2022-09-30 16:27:11 +09:00
merge_test.ts feat(streams/merge): earlyZipReadableStreams (#2264) 2022-05-26 13:26:17 +02:00
merge.ts feat(streams/merge): earlyZipReadableStreams (#2264) 2022-05-26 13:26:17 +02:00
mod.ts docs: improve module documentation (#2511) 2022-08-11 21:51:20 +10:00
README.md feat: streams utilities (#1141) 2021-10-12 11:51:48 +02:00

std/streams

Conversion

readerFromStreamReader

Creates a Reader from a ReadableStreamDefaultReader.

import {
  copy,
  readerFromStreamReader,
} from "https://deno.land/std@$STD_VERSION/streams/mod.ts";
const res = await fetch("https://deno.land");
const file = await Deno.open("./deno.land.html", { create: true, write: true });

const reader = readerFromStreamReader(res.body!.getReader());
await copy(reader, file);
file.close();

writerFromStreamWriter

Creates a Writer from a WritableStreamDefaultWriter.

import {
  copy,
  writerFromStreamWriter,
} from "https://deno.land/std@$STD_VERSION/streams/mod.ts";
const file = await Deno.open("./deno.land.html", { read: true });

const writableStream = new WritableStream({
  write(chunk): void {
    console.log(chunk);
  },
});
const writer = writerFromStreamWriter(writableStream.getWriter());
await copy(file, writer);
file.close();