method Channel.ready
Channel.ready(): Promise<void>

Resolves once there is room to emit again — Web Streams' writer.ready, and the promise form of Node's 'drain'.

Named for the condition it actually reports. It resolves when the buffer is below capacity, not when it is empty: with 9 of 10 buffered it resolves immediately, because there is room for a tenth. "Drained" would claim the opposite. It is also awaited in a loop rather than once, so it names a recurring gate, unlike the genuinely final closed.

Return Type

Promise<void>

Usage

import { type Channel } from "lib/stream/stream.ts";