package
Stream using async.queue under the hood.
npm install async-queue-streamGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Wrapper for through stream to use async.queue under the hood.
It takes an asynchronous function and queue stream chunks. Then the queue executes the asynchronous function up to the concurrency threshold.
Any error will be emitted to opts.error_event event. By default, the stream will not stop on error; this can be configured via opts.stop_on_error.
Install Node.js
Run: npm install async-queue-stream
Arguments
write_fn(data, callback) - an asnynchronous function that will be wrapped into a through stream
data is the queued stream chunk.
There are three ways to invoke callback:
callback(null, transformedData) - emit datacallback(error) - emit errorcallback() - drop data (don't emit to next stream)end_fn() - a function that will be invoked when no more data will be provided.
options - an object containing options
options.concurrency - concurrency argument to async.queue. Default: 1
options.error_event - event name used to emit the error from callback via the asynchronous function. Default: 'failure'
options.stop_on_error - boolean value for asyncqueue to stop queuing any more stream chunks if callback via the asynchronous function has emitted an error. Default: false
Note: Any tasks already executed will be able to complete.
var es = require('event-stream');
var qasync = require('queue-async-stream');
// something that returns stream using queue-async-stream internally
var plugin = function(filter, filter_func) {
if(filter_func == void 0)
filter_func = function(n) { return n; };
return qasync(function (data, cb) {
if(filter_func(data) == filter) {
setTimeout(function() {
return cb(new Error(filter+
MIT. See LICENSE file.