Jump to headingReadableBase.prototype.reduce<T = any>(): Promise<T>This method calls fn on each chunk of the stream in order, passing it the result from the calculation on the previous element. It returns a promise for the final value of the reduction.
If no initial value is supplied the first chunk of the stream is used as the initial value.
If the stream is empty, the promise is rejected with a TypeError with the ERR_INVALID_ARGS code property.
The reducer function iterates the stream element-by-element which means that there is no concurrency parameter
or parallelism. To perform a reduce concurrently, you can extract the async function to readable.map method.
Type Parameters Jump to heading
Jump to headingT = anyParameters Jump to heading
Jump to headingfn: () => Ta reducer function to call over every chunk in the stream. Async or not.
Jump to headinginitial: undefinedthe initial value to use in the reduction.
Jump to headingoptions: Pick<ArrayOptions, "signal">Return Type Jump to heading
Promise<T>a promise for the final value of the reduction.
Jump to headingReadableBase.prototype.reduce<T = any>(): Promise<T>Type Parameters Jump to heading
Jump to headingT = anyParameters Jump to heading
Jump to headingfn: () => TJump to headinginitial: TJump to headingoptions: Pick<ArrayOptions, "signal">Return Type Jump to heading
Promise<T>