Skip to main content
Module

x/workerio/mod.ts>WorkerWriter

🦕 Deno module to translate Worker's system of messages into Reader and Writer
Go to Latest
class WorkerWriter
implements [Deno.Writer], [Deno.Closer]
import { WorkerWriter } from "https://deno.land/x/workerio@v3.1.0/mod.ts";

A WorkerWriter is a Deno.Writer that defines a data channel of a Worker and writes data to it.

It notifies the peer that the data channel has finished writing, by sending a null message.

Constructors

new
WorkerWriter(worker: Worker)

Constructs a new WorkerWriter with the given Worker.

Methods

close(): void

Notify the peer that the data channel has finished writing, by sending a null message.

write(p: Uint8Array): Promise<number>

Writes p.byteLength bytes of data to the Worker using postMessage.

Note that this method does NOT guarantee that the data has been posted to the peer. Please refer to the following link for more information: https://github.com/lambdalisue/deno-workerio/issues/5