1.1.0 • Published 3 years ago

await-callback v1.1.0

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
3 years ago

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