Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/proc/legacy/examples/deps.ts>WritableIterable

A better way to work with processes in Deno.
Go to Latest
class WritableIterable
implements Writable<T>, AsyncIterable<T>
import { WritableIterable } from "https://deno.land/x/proc@0.20.41/legacy/examples/deps.ts";

Invert the normal data flow of an AsyncIterable, allowing you to push writes on one side and iterate on the other.

The write() side must call close() when all write operations are done.

Constructors

new
WritableIterable(options?: { onclose?: () => void | Promise<void>; })

Create a new PushIterable.

Properties

private
_closed: boolean
private
queue: QueueEntry<Some<T> | None>[]
readonly
isClosed

Methods

private
addEmptyPromiseToQueue(): void

Add an unresolved promise to the end of the queue.

close(error?: Error): Promise<void>
write(item: T): Promise<void>

It is an AsyncIterable<T>.