I am trying to download a file using a url link but I am getting following error
throw er; // Unhandled 'error' event
Error: connect ECONNREFUSED at exports._errnoException (util.js:746:11)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)
I have used wget url but I am getting below
failed: Connection refused
it was said that for https we need a server certificate and show it when we authenticate it but how to show certificate and get the file
i have used wireshark and saw that there is some problem with ssl handshake so i have downloaded the certificate of the server so what should i do now
My Nodejs code
var https = require('https');
var fs = require('fs');
var file = fs.createWriteStream("file.xlsx");
var request = https.get("https://example.com/secure/attachment/206906/a-373_update.xlsx", function(response) {
response.pipe(file);
});
http
module for making HTTPS requests (you need to use thehttps
module instead), which will throw an error (although a different one from what you're showing). – Richthofen