# co-thunkify

> Turn regular node function into a thunk for `co`.

Latest version **0.0.1** (published 2015-04-20) · MIT license · 0 weekly downloads

## Install

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

## 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.0.1 |
| Published | 2015-04-20 |
| First published | 2014-04-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | LightSpeedC |
| Maintainers | lightspeedc |
| Keywords | thunkify, thunk, co-thunkify, co, aa, async-await |

## Links

- npm: https://www.npmjs.com/package/co-thunkify
- Repository: https://github.com/LightSpeedWorks/co-thunkify
- Homepage: https://github.com/LightSpeedWorks/co-thunkify#readme
- Issues: https://github.com/LightSpeedWorks/co-thunkify/issues
- npm.io page: https://npm.io/package/co-thunkify

## Recent versions

- 0.0.1 (latest) — 2015-04-20
- 0.0.0 — 2014-04-05

## README

[co-thunkify][npm.lnk] - async await thunkify for `co`
==================================

  Turn a regular node function into one which returns a thunk,
  useful for generator-based flow control.

  [Japanese version/■日本語版はこちら■](README-JP.md#readme)

Installation
------------

```sh
$ npm install co-thunkify
```

[![npm][npm.png]][npm.lnk]
[npm.lnk]: https://www.npmjs.org/package/co-thunkify
[npm.png]: https://nodei.co/npm/co-thunkify.png

Examples
--------

### [read file example](examples/read-file-ex.js)

```js
var thunkify = require('co-thunkify');
var fs = require('fs');

// read file
var readFile = thunkify(fs.readFile);
readFile('package.json', 'utf8')(function (err, buff) {
  var str = buff.toString();
  // str...
});
```

### [sleep example](examples/sleep-ex.js)

```js
var thunkify = require('co-thunkify');

// sleep
var sleep = thunkify(function (ms, cb) {
  setTimeout(cb, ms);
});

console.log('sleep start...');
sleep(3000)(function () {
  console.log('3 seconds later...');
});
```

### [sync and async example](examples/sync-async-ex.js)

License
-------

  MIT

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