interface

ReadableStreamDirectController

interface ReadableStreamDirectController

  • error?: Error
    ): void;
  • end(): number | Promise<number>;
  • wait?: boolean
    ): number | Promise<number>;

    Flush any locally buffered data to the destination.

    @param wait

    When true, the returned promise resolves only once the destination has drained its own internal buffer (i.e. backpressure has cleared). Use this after write returns a Promise.

  • start(): void;
  • data: string | BufferSource
    ): number | Promise<number>;

    Write a chunk directly to the destination.

    Returns the number of bytes written, or a pending Promise<number> when the destination's internal buffer is full (backpressure). The chunk was accepted either way; awaiting the result is enough:

    await controller.write(chunk);

    The promise resolves once the destination has drained. await controller.flush(true) is equivalent.