Comparing version 0.3.1 to 0.3.2
28
index.js
@@ -1,2 +0,2 @@ | ||
'use strict'; /*jslint es5: true, node: true, indent: 2 */ /* globals setImmediate */ | ||
'use strict'; /*jslint es5: true, node: true, indent: 2 */ | ||
@@ -10,1 +10,27 @@ exports.Glob = require('./lib/glob'); | ||
exports.Timeout = require('./lib/timeout'); | ||
exports.readToEnd = function(stream, callback) { | ||
/** Read a stream to the end, buffering all chunks into an array. | ||
* `callback` Function Callback function with signature: function(err, [chunk_01, chunk_02, ...]) | ||
For example, to read all STDIN: | ||
streaming.readToEnd(sys.stdin, function(err, chunks) { | ||
if (err) throw err; | ||
var input = chunks.join(''); | ||
console.log('Got input of length: ' + input.length); | ||
}); | ||
*/ | ||
var chunks = []; | ||
return stream | ||
.on('error', callback) | ||
.on('data', function(chunk) { | ||
chunks.push(chunk); | ||
}) | ||
.on('end', function() { | ||
callback(null, chunks); | ||
}); | ||
}; |
{ | ||
"name": "streaming", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Transforms and other streaming helpers", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13545
296
12