ordered-read-streams

WebJar for ordered-read-streams

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

ordered-read-streams
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

ordered-read-streams
WebJar for ordered-read-streams
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/armed/ordered-read-streams

Download ordered-read-streams

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/ordered-read-streams/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>ordered-read-streams</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/ordered-read-streams/
implementation 'org.webjars.npm:ordered-read-streams:1.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/ordered-read-streams/
implementation ("org.webjars.npm:ordered-read-streams:1.0.1")
'org.webjars.npm:ordered-read-streams:jar:1.0.1'
<dependency org="org.webjars.npm" name="ordered-read-streams" rev="1.0.1">
  <artifact name="ordered-read-streams" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='ordered-read-streams', version='1.0.1')
)
libraryDependencies += "org.webjars.npm" % "ordered-read-streams" % "1.0.1"
[org.webjars.npm/ordered-read-streams "1.0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : readable-stream jar [2.0.1,3)

Project Modules

There are no modules declared in this project.

ordered-read-streams

NPM version Downloads Build Status Coveralls Status

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

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.

Usage

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

License

MIT

Versions

Version
1.0.1
0.1.0