Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function writerFromStreamWriter
Deprecated
Deprecated

(will be removed after 1.0.0) Use WritableStreamDefaultWriter directly.

import { writerFromStreamWriter } from "https://deno.land/std@0.220.0/streams/writer_from_stream_writer.ts";

Examples

Example 1

import { copy } from "https://deno.land/std@0.220.0/io/copy.ts";
import { writerFromStreamWriter } from "https://deno.land/std@0.220.0/streams/writer_from_stream_writer.ts";

using 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);

Parameters

streamWriter: WritableStreamDefaultWriter<Uint8Array>