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);
});
4

1 回答 1

0

我有一个类似的问题 -如何追踪节点网络代码中的错误?- 虽然我怀疑您的问题的细节与我的相同,但使用 NODE_DEBUG 环境变量可能也会对您的情况有所帮助。

于 2019-01-18T19:59:59.237 回答