co-process
Concurrent producer/consumer processing for co
Last updated 4 years ago by juliangruber .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install co-process 
SYNC missed versions from official npm registry.

co-process

Concurrent producer/consumer processing for co with optional concurrency control.

Also see co-thread for a more lightweight but buffering implementation.

Example

var co = require('co');
var process = require('co-process');

co(function*(){
  yield process(getData(), function*(data){
    data = yield transform(data);
    yield db.put(data);
  });
})();

API

process(producer, consumer)

Let consumer concurrently process work from producer.

Whenever producer yields data - and maximum concurrency isn't reached - it will be read immediately. Stop processing by yielding a falsy value.

Options:

- max: limit maximum concurrency
- timeout: kill workers after x milliseconds (default: 100)

Debugging

Set or add co-process to the DEBUG env variable to see how workers spawn, die and consume work.

Installation

$ npm install co-process

License

MIT

Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (5)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |