Converting nodeback library to Promises

suggest change
const Promise = require('bluebird'),
      fs = require('fs')

Promise.promisifyAll(fs)

// now you can use promise based methods on 'fs' with the Async suffix
fs.readFileAsync('file.txt').then(contents => {
  console.log(contents)
}).catch(err => {
  console.error('error reading', err)
})

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents