Skip to content

Instantly share code, notes, and snippets.

@pionize
Created April 17, 2017 10:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save pionize/10575a50321a2ea6d9ca228f29ad9612 to your computer and use it in GitHub Desktop.
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