UNPKG

@johngw/stream

Version:

Reactive programming tools using the WHATWG Streams API.

25 lines 639 B
/** * Makes sure that events are emitted within `ms`. * Otherwise emits an error. * * @group Transformers * @throws {@link TimeoutError} * @example * readableStream * .pipeThrough(timeout(1_000)) * .pipeTo(write()) * .catch(error => { * // error is TimeoutError if any event took too long * }) */ export declare function timeout<T>(ms: number): import("node:stream/web").TransformStream<T, T>; /** * The error emitted from {@link timeout}. * * @group Transformers */ export declare class TimeoutError extends Error { readonly ms: number; constructor(ms: number); } //# sourceMappingURL=timeout.d.ts.map