Create a TransformStream that produces a stream of accumulated values
The scanner function to apply to each chunk
The initial value for the scan
A TransformStream that emits each intermediate accumulated value
// Calculate running sumconst stream = readable.pipeThrough(scan((acc, x) => acc + x, 0));// If readable emits [1, 2, 3], the result will be [1, 3, 6] Copy
// Calculate running sumconst stream = readable.pipeThrough(scan((acc, x) => acc + x, 0));// If readable emits [1, 2, 3], the result will be [1, 3, 6]
Create a TransformStream that produces a stream of accumulated values