Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/brechtcs/await-callback


https://github.com/brechtcs/await-callback

Last synced: about 11 hours ago
JSON representation

Awesome Lists containing this project

README

        

# await-callback

Wrap and await callback code

## Usage

```js
var promise = require('await-callback')
var fs = require('fs')

async function main () {
var result = await promise(done => {
fs.writeFile('hello', 'world', 'utf8', err => {
if (err) return done(err)
fs.readFile('hello', 'utf8', done)
})
})

console.log(result) // 'world'
}

main()
```

## License

Apache-2.0