Skip to content

Instantly share code, notes, and snippets.

@Janoyan
Created April 5, 2020 14:38
Show Gist options
  • Save Janoyan/3880f9e787e1ce15954ace5c0ef2523e to your computer and use it in GitHub Desktop.
Save Janoyan/3880f9e787e1ce15954ace5c0ef2523e to your computer and use it in GitHub Desktop.
const bluebird = require('bluebird');
function echo(text, callback) {
callback(null, text);
}
const echoPromise = bluebird.promisify(echo);
echo('Hello', (err, result) => {
console.log(`From callback: ${result}`);
});
echoPromise('Hello').then((result) => {
console.log(`From promise: ${result}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment