Node 8 util.promisfy

Example usage of the util.promisfy function that was introduced in Node 8

June 18, 2017 - 1 minute read -
node

Node 8 added a promisify function to the util core module. A couple of simple usage examples follow.

Usage with a promise

Usage with async/await

Multiple callback arguments

If the callback takes multiple arguments the promise will resolve to an object with a key/value for each argument.