
上QQ阅读APP看书,第一时间看更新
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.