Module

x/dax/src/deps.ts>writerFromStreamWriter

Cross-platform shell tools for Deno and Node.js inspired by zx.
Extremely Popular
Latest
function writerFromStreamWriter
Deprecated
Deprecated

(will be removed after 1.0.0) Use {@link WritableStreamDefaultWriter} directly.

import { writerFromStreamWriter } from "https://dotland.deno.dev/x/dax@0.39.2/src/deps.ts";

Create a {@link Writer} from a {@link WritableStreamDefaultWriter}.

Examples

Example 1

import { copy } from "https://deno.land/std@$STD_VERSION/io/copy.ts";
import { writerFromStreamWriter } from "https://deno.land/std@$STD_VERSION/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>

Returns

Writer