🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

co-thread

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

co-thread

spawn multiple co 'threads'

0.0.1
latest
Source
npm
Version published
Weekly downloads
3.1K
5.02%
Maintainers
1
Weekly downloads
 
Created
Source

co-thread

Run a generator function in parallel N times.

Installation

$ npm install co-thread

Example

Send a request in batches of 20 parallel GETs:

var thread = require('co-thread');
var get = require('co-request');
var co = require('co');

co(function *(){
  var times = 10;

  while (times--) {
    yield thread(function *(){
      var res = yield get('http://google.com');
      console.log(res.statusCode);
    }, 20);
  }

})();

License

MIT

Keywords

co

FAQs

Package last updated on 01 Feb 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts