Skip to content

StreamEmit

3 exports Added in v2.0.0 Source

Models

Emit interface

Added in v2.0.0 Source

An Emit<R, E, A, B> represents an asynchronous callback that can be called multiple times. The callback can be called with a value of type Effect<Chunk<A>, Option<E>, R>, where succeeding with a Chunk<A> indicates to emit those elements, failing with Some<E> indicates to terminate with that error, and failing with None indicates to terminate with an end of stream signal.

Signature

interface Emit<in R, in E, in A, out B> extends EmitOps<R, E, A, B> {
(f: Effect<Chunk<A>, Option<E>, R>): Promise<B>;
}

EmitOps interface

Added in v2.0.0 Source

Signature

interface EmitOps<in R, in E, in A, out B> {
chunk(chunk: Chunk<A>): Promise<B>;
die<Err>(defect: Err): Promise<B>;
dieMessage(message: string): Promise<B>;
done(exit: Exit<A, E>): Promise<B>;
end(): Promise<B>;
fail(error: E): Promise<B>;
fromEffect(effect: Effect<A, E, R>): Promise<B>;
fromEffectChunk(effect: Effect<Chunk<A>, E, R>): Promise<B>;
halt(cause: Cause<E>): Promise<B>;
single(value: A): Promise<B>;
}

EmitOpsPush interface

Added in v3.6.0 Source

Signature

interface EmitOpsPush<in E, in A> {
array(chunk: readonly Array<A>): boolean;
chunk(chunk: Chunk<A>): boolean;
die<Err>(defect: Err): void;
dieMessage(message: string): void;
done(exit: Exit<A, E>): void;
end(): void;
fail(error: E): void;
halt(cause: Cause<E>): void;
single(value: A): boolean;
}