- Modern JavaScript Web Development Cookbook
- Federico Kereki
- 82字
- 2025-04-04 15:19:00
There's more…
Keep in mind that you won't always be needing util.promisify(). There are two reasons for this:
- Some libraries (such as axios, which we already used) already return promises, so you don't have to do anything
- Some other methods (such as the http.request() method of Node; see https://nodejs.org/dist/latest-v9.x/docs/api/http.html#http_http_request_options_callback) have a different signature altogether, without even an error argument
In any case, aiming for a standard usage will help, so we'll adopt the promise-based style for the rest of the book.