Stream.fold<U>(fn: (acc: U,value: T,) => Promisable<U>,initialValue: U,): Promise<U>
Similar to Array.prototype.reduce, but works on the stream of results. If the provided function throws an error or returns a rejected promise, the error will be collected and emitted as an error result in the stream.
If any error results are present in the stream, they will be thrown as an
AggregateError after the stream is exhausted. Use filterErr(() => false)
upstream to explicitly drop errors if you want to fold only the successes.
Promise<U>