The type of values emitted by the flow.
Additional arguments to pass to the flow.
Registers a callback to handle errors thrown during the execution of the current flow.
A callback function to handle errors. It takes the thrown error as its parameter and must return a new readable flow as its result.
A new readable flow that continues with the current flow's results or with the result of the error handling callback in case of an error.
Produces a new flow of distinct values by comparing each emitted value with the previous one. Values are considered distinct if they are not equal based on the provided equality function.
The initial reference value to compare against. If not provided, no initial comparison is made.
Configuration options for distinguishing values, which includes:
equal: A function used to compare two values for equality. Defaults to strict equality (===).A new readable flow that emits distinct values.
Creates a new flow that skips a specified number of items from the beginning of the current flow.
The number of items to skip from the start of the flow.
A new flow that yields all items from the current flow after skipping the specified count.
Returns true if all the values emitted by the flow satisfy the provided predicate.
An AbortSignal to allow for the operation to be canceled.
A function to test each value from the flow. It should return a boolean.
Additional arguments to pass to the flow.
A promise that resolves to true if all the values satisfy the predicate, otherwise false.
Filters the values of the flow based on the provided filter function.
A new flow containing only the values that satisfy the filter function.
Filters the values of the flow based on the provided filter function.
A function that determines whether each value in the flow should be included.
A new flow containing only the values that satisfy the filter function.
Registers a function to be executed when the flow is completed, regardless of whether it succeeded or failed.
A function to be invoked after the flow has been executed. It can optionally return a promise, and the flow will wait for the promise to resolve or reject.
A new instance of ReadableFlow that ensures the provided finally function
is executed after the flow completes.
Finds an item in a collection that matches the provided predicate.
An AbortSignal to allow for the operation to be canceled.
A function used to test each item in the collection.
Additional arguments to pass to the flow.
A promise that resolves to the first item that matches the predicate, or undefined if no match is found.
Finds an item in a collection that matches the provided predicate.
An AbortSignal to allow for the operation to be canceled.
A function used to test each item in the collection.
Additional arguments to pass to the flow.
A promise that resolves to the first item that matches the predicate, or undefined if no match is found.
Retrieves the first value sent by the flow. If the stream is completed without sending a value, an error is thrown.
An AbortSignal to allow for the operation to be canceled.
Additional arguments to pass to the flow.
A promise that resolves to the first value emitted by the flow.
Transforms each element of the flow using the provided function and flattens the result into a single flow.
A function that takes an element of the flow and returns a new flow for the elements to be flattened into the resulting flow.
A new ReadableFlow instance representing the flattened output flow
after applying the flat-map transformation.
Iterates over the flow and invokes the provided callback for each value.
An AbortSignal to allow for the operation to be canceled.
The function to execute for each value in the flow.
Additional arguments to pass to the flow.
A promise that resolves once all values have been processed or rejects if an error occurs.
Creates a fork of the flow, allowing multiple consumers to independently read from the same source. On the first consumer, this flow opens and sends its values to this consumer and all the following, and closes when all the consumers terminate.
The forked flow can optionally maintain its state for a specified duration even after the last consumer ends.
Configuration options for the fork.
Optional ReadonlymaintainAlive?: numberA new readable flow instance that provides a shared stream of values from the original source.
Inspects the flow by invoking specified callbacks at various stages of its lifecycle. Allows the execution of provided hooks to monitor or manipulate the flow's behavior.
Optionaloptions: ReadableFlowInspectOptions<GValue, GArguments> = {}The set of lifecycle hooks to be invoked.
open: A callback invoked when the flow starts.next: A callback invoked for each value being yielded by the flow.error: A callback invoked when an error occurs in the flow.close: A callback invoked when the flow finishes or is closed.A new readable flow with inspection hooks applied.
Retrieves the last value emitted by the flow.
An AbortSignal to allow for the operation to be canceled.
Additional arguments to pass to the flow.
A promise that resolves to the last emitted value.
Transforms each value in the flow using the provided mapping function.
A new ReadableFlow instance containing the transformed values.
Transforms and filters elements of the flow based on the provided function.
For each element, the function is called. If the function returns NONE,
the element is filtered out; otherwise, the transformed value is included in the resulting flow.
A new readable flow containing transformed and filtered elements.
Opens this Flow: it calls the provided factory function with a corresponding FlowContext.
The provided signal is used to abort the current pending iteration.
The AbortSignal that must be used to abort the current pending iteration.
The arguments to pass to the factory function.
An AsyncEnumeratorObject that will be used to iterate over the flow.
Reduces the values produced by the flow using the provided reducer function.
An AbortSignal to allow for the operation to be canceled.
A function that takes the accumulated value and the current value, and returns the new accumulated value.
The initial value for the reduction or a special value indicating no initial value.
Additional arguments to pass to the flow.
A promise that resolves with the final reduced value after the iteration completes.
Reduces the values produced by the flow using the provided reducer function.
An AbortSignal to allow for the operation to be canceled.
A function that takes the accumulated value and the current value, and returns the new accumulated value.
The initial value for the reduction or a special value indicating no initial value.
Additional arguments to pass to the flow.
A promise that resolves with the final reduced value after the iteration completes.
Returns true if one of the values emitted by the flow satisfies the provided predicate.
An AbortSignal to allow for the operation to be canceled.
A function to test each value from the flow. It should return a boolean.
Additional arguments to pass to the flow.
A promise that resolves to true if at least one value satisfies the predicate, otherwise false.
Creates a new ReadableFlow instance that emits only the first count values from the current flow.
The maximum number of values to take from the flow. Must be greater than or equal to 0.
A new ReadableFlow instance emitting up to count values.
Creates a new ReadableFlow that emits values from the current flow until the untilSource emits a value or completes.
A readable flow that determines when to stop emitting values. Once this flow emits a value, the returned flow completes.
A new readable flow that terminates when the untilSource emits its first value or completes.
Converts this readable flow into an array containing the values emitted by the flow.
An AbortSignal to allow for the operation to be canceled.
Additional arguments to pass to the open method.
A promise that resolves to an array of GValue.
Converts this flow into a ReadableStream. This stream mimics the behavior of this flow.
Additional arguments to pass to the flow.
A ReadableStream that mimics the behavior of this flow.
StaticcombineCombines multiple readable flows into a single flow that produces an array of the latest values emitted from each flow.
An array-like object containing readable flows to be combined.
A readable flow that outputs an array with the most recent values emitted by the input flows.
Combines multiple readable flows into a single flow that produces a record of the latest values emitted from each flow.
A record containing readable flows to be combined.
A readable flow that outputs a record with the most recent values emitted by the input flows.
StaticconcatCombines multiple readable flows into a single flow, concatenating their outputs.
An array of readable flows to be concatenated.
A single concatenated readable flow combining all inputs.
StaticfromCreates a new ReadableFlow instance from an array-like object.
The array-like object to convert into a readable flow.
A readable flow that iterates over the elements of the given array-like object.
StaticfromCreates a ReadableFlow instance from an AsyncIterable.
The async iterable to convert into a ReadableFlow.
A ReadableFlow representing the provided AsyncIterable.
StaticfromCreates a new ReadableFlow instance from the provided iterable.
The input iterable to create a ReadableFlow from.
A new ReadableFlow instance that processes the values from the iterable.
StaticfromCreates a new ReadableFlow instance using a factory function that returns a promise or a value.
A factory function that accepts an AbortSignal and additional arguments, returning a promise-like value or a direct value.
A new ReadableFlow instance that generates values as resolved by the factory function.
StaticfromCreates a ReadableFlow from a push-based data source.
A function to initialize the push-based data source. The function receives a controller object that includes methods for pushing the next value, signaling an error, or completing the stream, as well as an AbortSignal for handling cancellations.
A ReadableFlow that converts the push-based data source into a pull-based stream.
StaticofCreates a new ReadableFlow instance from the provided arguments.
The values to be included in the resulting flow.
A new ReadableFlow instance containing the specified values.
StaticthrownCreates a new ReadableFlow that always throws an error produced by the provided factory function.
A function that generates the error to be thrown.
A ReadableFlow that throws the error.
StaticwhenCreates a ReadableFlow that listens to a specified event type on a given EventTarget.
The target object to listen for events on.
The type of event to listen for.
A readable flow that emits events of the specified type.
Represents a readable flow of values that can be consumed asynchronously.