request should provide a custom util.promisified() version
See original GitHub issueCode like
request('https://example.com', (error, response, body) => {
...
});
can’t be promisified through the usual util.promisify()
function in Node 8.x because it goes beyond the standard (error, result) => …
callback pattern. It should be pretty easy to fix that by providing a custom implementation that gives e.g. a Promise for a {response, body}
object.
I know there’s request-promise
, and I can’t really tell how much of request
this affects, but it would be awesome if a library that is this popular had even just very simple support for it.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:19
- Comments:6
Top Results From Across the Web
NodeJs: util.promisify where the callback function has multiple ...
You'll need to provide a custom promisify implementation for the function. const { promisify } = require('util') ...
Read more >Node.js 8: `util.promisify()` - 2ality
Node.js 8 has a new utility function: util.promisify() . It converts a callback-based function to a Promise-based one.
Read more >Promisification - The Modern JavaScript Tutorial
A call to promisify(f) returns a wrapper around f (*) . That wrapper returns a promise and forwards the call to the original...
Read more >Returning Promises with Promisfy in Node.js - Bits and Pieces
In this tutorial, I'll introduce you to the Promisify utility available in the Util Package of Node.js. In a nutshell, Promisify is an...
Read more >New util.promisify in Node.js - Bruno Scopelliti
I used to have too my personal utility to convert Node.js callback-based internals methods into returning-promise ones.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is what should happen:
Then you could use it like this:
Or even:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.