ordered-read-streams
Combines array of streams into one read stream in strict order
Last updated 3 years ago by phated .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ordered-read-streams 
SYNC missed versions from official npm registry.

ordered-read-streams NPM version Build Status

Combines array of streams into one read stream in strict order.

Installation

npm install ordered-read-streams

Overview

ordered-read-streams handles all data/errors from input streams in parallel, but emits data/errors in strict order in which streams are passed to constructor. This is objectMode = true stream.

Example

var through = require('through2');
var Ordered = require('ordered-read-streams');

var s1 = through.obj(function (data, enc, next) {
  var self = this;
  setTimeout(function () {
    self.push(data);
    next();
  }, 200)
});
var s2 = through.obj(function (data, enc, next) {
  var self = this;
  setTimeout(function () {
    self.push(data);
    next();
  }, 30)
});
var s3 = through.obj(function (data, enc, next) {
  var self = this;
  setTimeout(function () {
    self.push(data);
    next();
  }, 100)
});

var streams = new Ordered([s1, s2, s3]);
streams.on('data', function (data) {
  console.log(data);
})

s1.write('stream 1');
s1.end();

s2.write('stream 2');
s2.end();

s3.write('stream 3');
s3.end();

Ouput will be:

stream 1
stream 2
stream 3

Licence

MIT

Current Tags

  • 1.0.1                                ...           latest (3 years ago)

13 Versions

  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.3.0                                ...           4 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
  • 0.0.8                                ...           5 years ago
  • 0.0.7                                ...           6 years ago
  • 0.0.6                                ...           6 years ago
  • 0.0.5                                ...           6 years ago
  • 0.0.4                                ...           6 years ago
  • 0.0.3                                ...           6 years ago
  • 0.0.2                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
Maintainers (2)
Downloads
Today 92
This Week 92
This Month 46,904
Last Day 1,081
Last Week 23,424
Last Month 94,930
Dependencies (1)
Dev Dependencies (7)

Copyright 2014 - 2016 © taobao.org |