I need to get the Content-Length
and Content-Type
headers of large files with Node.
Unfortunately, the server I\'m dealing with do
The http library of nodejs by default it will not fetch everything but give the callback will contain the IncomingMessage object, to construct the full response you would have to listen to .on('data').
Take a look at:
https://nodejs.org/api/http.html#http_http_get_options_callback
If you then want to "ignore" the incoming data, you can just call res.abort(). Calling this will cause remaining data in the response to be dropped and the socket to be destroyed.