@sealsystems/stream-assembler

1.1.4 • Public • Published

@sealsystems/stream-assembler

Assemble data from multiple read streams into a single write stream.

Installation

npm install @sealsystems/stream-assembler

Quick start

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);

API

constructor(readables[, options])

  • readables <array> | <function> Creates an object of type Assembler.
  • options <Object> Pipe options
    • end <boolean> End the writer after all readers end. Defaults to true.

The readables array has to contain objects implementing the stream.Readable interface.

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.

assembler.pipe(writeable)

  • writeable <stream.Writeable> The destination for writing data.

Throws on error and returns null on success.

The 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);

Dependents (0)

Package Sidebar

Install

npm i @sealsystems/stream-assembler

Weekly Downloads

0

Version

1.1.4

License

MIT

Unpacked Size

6.31 kB

Total Files

5

Last publish

Collaborators

  • seal-mt
  • michaelscherer-seal
  • comgit
  • gel