httpnode.jsasynchronousgetsynchronous

Node.js: Is there a synchronous version of the `http.get` method in node.js?


Is there a synchronous version of the http.get method in node.js?

Something like:

http.getSync({
    host: 'google.com', 
    port: 80, 
    path: '/'
}, function(response){  

});

console.log(response)

Sometimes it would be very useful.


Solution

  • No, there isn't. I honestly don't see the use case.

    If you expand upon your use case or a problem that you're trying to solve, I'll try to answer that.