Assemble data from multiple read streams into a single write stream.
npm install @sealsystems/stream-assembler
First you need to add a reference to
@sealsystems/stream-assembler within your application.
const Assembler = require('@sealsystems/stream-assembler');
Then you can create an assembler object.
const assembler = new Assembler(readables);
readables<array> | <function> Creates an object of type
options<Object> Pipe options
end<boolean> End the writer after all readers end. Defaults to true.
readables array has to contain objects implementing the
readables function has to be either a synchronous or an
async function for which the assembler object can
await for. The function is called without any parameter and has to return the next read stream at each call or null if no read streams left.
writeable<stream.Writeable> The destination for writing data.
Throws on error and returns null on success.
pipe function attaches the
writeable stream to all readable streams one at a time in the order the readable streams are given.
const assembler = new Assembler(readables); await assembler.pipe(writeable);