ordered-read-streams
Advanced tools
Comparing version
33
index.js
@@ -1,2 +0,3 @@ | ||
var Readable = require('stream').Readable; | ||
var Readable = require('readable-stream').Readable; | ||
var isReadable = require('isstream').isReadable; | ||
var util = require('util'); | ||
@@ -7,7 +8,4 @@ | ||
{ | ||
if(!stream.readable) throw new Error('All input streams must be readable'); | ||
if(!isReadable(stream)) throw new Error('All input streams must be readable'); | ||
if(this._readableState.ended) throw new Error('Adding streams after ended'); | ||
var self = this; | ||
@@ -17,4 +15,8 @@ | ||
stream.on('data', function(chunk) | ||
stream.on('readable', function() | ||
{ | ||
var chunk = stream.read(); | ||
if (chunk === null) | ||
return; | ||
if(this === streams[0]) | ||
@@ -44,3 +46,2 @@ self.push(chunk); | ||
streams.push(stream); | ||
@@ -70,16 +71,10 @@ } | ||
this.concat = function() | ||
streams.forEach(function(item) | ||
{ | ||
Array.prototype.forEach.call(arguments, function(item) | ||
{ | ||
if(Array.isArray(item)) | ||
item.forEach(addStream_bind); | ||
if(Array.isArray(item)) | ||
item.forEach(addStream_bind); | ||
else | ||
addStream_bind(item); | ||
}); | ||
}; | ||
this.concat(streams); | ||
else | ||
addStream_bind(item); | ||
}); | ||
} | ||
@@ -86,0 +81,0 @@ util.inherits(OrderedStreams, Readable); |
{ | ||
"name": "ordered-read-streams", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Combines array of streams into one read stream in strict order", | ||
@@ -21,3 +21,7 @@ "main": "index.js", | ||
"pre-commit": "0.0.4" | ||
}, | ||
"dependencies": { | ||
"isstream": "^0.1.1", | ||
"readable-stream": "^1.0.33" | ||
} | ||
} |
8716
0.37%2
Infinity%196
-0.51%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added