Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    co-threadpublic

    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

    none

    install

    npm i co-thread

    Downloadsweekly downloads

    38,323

    version

    0.0.1

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar