Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created October 31, 2013 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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