multi-readable
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

multi-readable

Serial connecting readable streams, strictly following the back pressure and highWaterMark.

Install

npm i multi-readable

Example

import { createReadStream } from "fs";
import { MultiBufferReadable } from "multi-readable";

const stream = new MultiBufferReadable(
  [createReadStream("package.json"), createReadStream("package.json")],
  { highWaterMark: 16 }
);

for await (const chunk of stream) {
  // do sth
}
import { Readable } from "stream";
import { MultiObjectReadable } from "multi-readable";

const data = [];
for (let i = 0; i < 1024; i++) {
  data.push({ i });
}

const stream = new MultiObjectReadable(
  [Readable.from(data), Readable.from(data)],
  {
    highWaterMark: 16,
  }
);

for await (const object of stream) {
  // do sth
}

API

Class MultiBufferReadable

new MultiBufferReadable(streams: Readable[], opts?: MultiBufferReadableOptions): MultiBufferReadable
  • streams: Readable[]
  • opts (Optional) : MultiBufferReadableOptions

Interface MultiBufferReadableOptions

equivalent to fs.ReadableOptions, but with objectMode removed

Class MultiObjectReadable

new MultiObjectReadable(streams: Readable[], opts?: MultiObjectReadableOptions): MultiObjectReadable
  • streams: Readable[]
  • opts (Optional) : MultiObjectReadableOptions

Interface MultiObjectReadableOptions

equivalent to MultiBufferReadableOptions

License

MIT

/multi-readable/

    Package Sidebar

    Install

    npm i multi-readable

    Weekly Downloads

    2

    Version

    1.1.0

    License

    ISC

    Unpacked Size

    12.2 kB

    Total Files

    5

    Last publish

    Collaborators

    • tarrowren