Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Bluebird Promise
// using Bluebird Promise
const Promise = require('bluebird');
new Promise(function (resolve, reject) {
fs.readFile('myfile.txt', function (err, file) {
if (err) {
return reject(err);
}
resolve(file);
});
}).then(/* ... */)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment