Use bluebirds .from callback function to easily to await on a function that takes a callback).
This only works if your callbacks are called in the standard way though, ie (err, result).
const Promise = require('bluebird');
await Promise.fromCallback(callback => functionThatTakesACallback(arg1, arg2, callback));
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Use bluebirds .from callback function to easily to await on a function that takes a callback).
This only works if your callbacks are called in the standard way though, ie (err, result).
const Promise = require('bluebird');
await Promise.fromCallback(callback => functionThatTakesACallback(arg1, arg2, callback));