# co-runner

> coroutine runner

Latest version **0.2.0** (published 2015-05-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install co-runner
pnpm add co-runner
yarn add co-runner
bun add co-runner
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2015-05-25 |
| First published | 2015-05-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | hxc |
| Maintainers | xiaocong.hxc |

## Links

- npm: https://www.npmjs.com/package/co-runner
- Repository: https://github.com/bigfactory/co-runner
- Issues: https://github.com/bigfactory/co-runner/issues
- npm.io page: https://npm.io/package/co-runner

## Recent versions

- 0.2.0 (latest) — 2015-05-25
- 0.1.1 — 2015-05-13
- 0.1.0 — 2015-05-13

## README

### Usage

```

var fs = require('fs');
var thunkify = require('thunkify');
var runner = require('co-runner');

var getFile = thunkify(function(){
    fs.readFile.apply(fs, arguments);
});

function* getFileGenerator() {
    var list = ['/tmp/1.txt', '/tmp/2.txt'];
    var result = [];
    var content;

    for (var i = 0, len = list.length; i < len; i++) {
        content = yield getFile(list[i]);
        result.push(content);
    }
    
    return result;
}

runner(getFileGenerator(), function(err, result){
    if(err){
        //return false to break the flow
        return false;
    }
    console.log(data);
});

```

---
_Source: https://npm.io/package/co-runner · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
