我正在尝试从jira服务器下载文件,但我收到连接拒绝错误(tls握手错误)使用请求模块是否有任何jira模块,我可以用来从jira服务器下载文件
我的nodejs代码:
var https = require('https');
var fs = require('fs');
var file = fs.createWriteStream("file.xlsx");
var request = https.get("https://gec-jira01.example.com/secure/attachment/206906/A-37_update.xlsx", function(response) {
response.pipe(file);
});
答案 0 :(得分:0)
var credentials = 'user:pass';
var encodedCredentials = new Buffer(credentials).toString('base64');
request({
method: "GET",
"rejectUnauthorized": false,
"url": url,
"headers" :
{
"Content-Type": "application/json",
"Authorization": "Basic"+' '+encodedCredentials
}
},function(err,data,body){
//console.log(data.body);
console.log('file downloading');
}).pipe(fs.createWriteStream('file.xlsx'));