Convert a Callback-Based JavaScript Function to a Promise-Based One
lessonDuration 5m 2s
Sometimes, you might want to convert a JavaScript function that accepts a callback to one that returns a `Promise` object. This lesson shows how to manually wrap a promise-based API around the [`fs.readFile()`](https://nodejs.org/api/fs.html#fs_fs_readfile_path_options_callback) function. It also explains how to use the [`util.promisify()`](https://nodejs.org/api/util.html#util_util_promisify_original) method that is built into the Node.js standard library.