mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-22 05:59:31 +08:00
pipeline() accepts a run of async generator function stages between streams, following pipeline.js: each stage is called during setup with the previous stream (a Readable is async iterable) or the previous stage's generator, and the last generator is pumped into the next stream with pumpToNode's write, drain and end waits. An error in the pump loop returns the generator before the pipeline finishes, so the stage's finally runs. A stage's source parameter is typed as what the pipeline passes it and may only head for await loops. Function sources and destinations, stages that take the signal argument, and stages separated by streams are refused.