Created
April 17, 2017 10:10
-
-
Save pionize/10575a50321a2ea6d9ca228f29ad9612 to your computer and use it in GitHub Desktop.
Bluebird Promise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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