JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 229617
  • Score
    100M100P100Q185948F

Pipe queued streams progressively.

Package Exports

  • streamqueue

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (streamqueue) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

StreamQueue NPM version Build Status

StreamQueue pipe the queued streams one by one in order to preserve their content order.

Usage

Install the npm module:

npm install streamqueue --save

Then, in your scripts:

var streamqueue = require('streamqueue');

var queue = streamqueue(
  Fs.createReadStream('input.txt'),
  Fs.createReadStream('input2.txt'),
  Fs.createReadStream('input3.txt')
).pipe(process.stdout);

Object-oriented traditionnal API offers more flexibility:

var StreamQueue = require('streamqueue');

var queue = new StreamQueue();
queue.queue(
  Fs.createReadStream('input.txt'),
  Fs.createReadStream('input2.txt'),
  Fs.createReadStream('input3.txt')
);
queue.done();

queue.pipe(process.stdout);

You can also chain StreamQueue methods like that:

var StreamQueue = require('streamqueue');

new StreamQueue()
  .queue(Fs.createReadStream('input.txt'))
  .queue(Fs.createReadStream('input2.txt'))
  .queue(Fs.createReadStream('input3.txt'))
  .done()
  .pipe(process.stdout);

You can queue new streams at any moment until you call the done() method. So the created stream will not fire the end event until done() call.

API

StreamQueue([options], [stream1, stream2, ... streamN])

options.pause

Type: Boolean Default value: false

Pause each stream before queueing.

options.*

StreamQueue inherits of Stream.PassThrough, the options are passed to the parent constructor so you can use it's options too.

streamN

Type: Stream

Append streams given in argument to the queue and ends when the queue is empty.

StreamQueue.queue(stream1, [stream2, ... streamN])

Append streams given in argument to the queue.

StreamQueue.done([stream1, stream2, ... streamN])

Append streams given in argument to the queue and ends when the queue is empty.

options.pause

Type: Boolean Default value: false

Pause each queued streams.

Contributing

Feel free to pull your code if you agree with publishing it under the MIT license.