7

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);
});
Pete
  • 57,112
  • 28
  • 117
  • 166
Labeo
  • 5,831
  • 13
  • 47
  • 77

1 Answers1

0

I had a similar issue - How to track down error in node network code? - while I doubt the details of your issue are the same as mine, it's likely that using the NODE_DEBUG environmental variable would help in your case also.

rdm
  • 658
  • 5
  • 16