Converting nodeback library to Promises
suggest changeconst 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)
})
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents