Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created October 31, 2013 18:47
Show Gist options
  • Save tmcw/7254836 to your computer and use it in GitHub Desktop.
Save tmcw/7254836 to your computer and use it in GitHub Desktop.
npm install --save queue-async
var queue = require('queue-async');
var q = queue(8);
['things'].forEach(function(t) {
q.defer(doTask);
});
function doTask(thing, callback) {
// do stuff with this and then
callback(null, result);
}
q.awaitAll(function(err, results) {
// this is called after all done
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment