Execute thunks in parallel with concurrency support
JavaScript
Latest commit 2b40582 Mar 4, 2014 @tj Release 1.0.0
Permalink
Failed to load latest commit information.
.gitignore Initial commit Jan 3, 2014
History.md Release 1.0.0 Mar 4, 2014
Makefile Initial commit Jan 3, 2014
Readme.md fix require in example Jan 3, 2014
example.js refactor example Mar 4, 2014
index.js fix weird conditional Mar 4, 2014
package.json Release 1.0.0 Mar 4, 2014

Readme.md

co-parallel

Parallel execution with concurrency support that maintains result ordering.

Installation

$ npm install co-parallel

Example

var parallel = require('co-parallel');
var request = require('co-request');
var co = require('co');

var urls = [
  'http://google.com',
  'http://yahoo.com',
  'http://ign.com',
  'http://cloudup.com',
  'http://myspace.com',
  'http://facebook.com',
  'http://segment.io'
];

function *status(url) {
  console.log('GET %s', url);
  return (yield request(url)).statusCode;
}

co(function *(){
  var reqs = urls.map(status);
  var res = yield parallel(reqs, 2);
  console.log(res);
})();

API

parallel(thunks, [concurrency])

Execute thunks in parallel, with the given concurrency defaulting to 5.

License

MIT