co-parallel
parallel execution with concurrency control
Last updated 11 years ago by tjholowaychuk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install co-parallel 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.0                                ...           latest (11 years ago)

2 Versions

  • 1.0.0                                ...           11 years ago
  • 0.0.1                                ...           11 years ago
Maintainers (1)
Downloads
Total 3
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (4)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE