Interface ReadableStream<T>

A interface that emulates the API shape of a node.js readable stream for use in desktop and web environments.

interface ReadableStream<T> {
    destroy(): void;
    on(event, callback): void;
    on(event, callback): void;
    on(event, callback): void;
    pause(): void;
    removeListener(event, callback): void;
    resume(): void;
}

Type Parameters

  • T

Hierarchy (view full)

Methods

  • The 'data' event is emitted whenever the stream is relinquishing ownership of a chunk of data to a consumer.

    Parameters

    • event: "data"
    • callback: ((data) => void)
        • (data): void
        • Parameters

          • data: T

          Returns void

    Returns void

  • Emitted when any error occurs.

    Parameters

    • event: "error"
    • callback: ((err) => void)
        • (err): void
        • Parameters

          • err: Error

          Returns void

    Returns void

  • The 'end' event is emitted when there is no more data to be consumed from the stream. The 'end' event will not be emitted unless the data is completely consumed.

    Parameters

    • event: "end"
    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Allows to remove a listener that was previously added.

    Parameters

    • event: string
    • callback: Function

    Returns void