await-callback
v1.1.0
Published
Wrap and await callback code
Downloads
3
Maintainers
Readme
await-callback
Wrap and await callback code
Usage
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