1.1.0 • Published 4 years ago
await-callback v1.1.0
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