如何从JIRA服务器使用的NodeJS

问题描述:

我试图从JIRA服务器下载文件,但是我得到使用请求模块都存在,我可以使用任何JIRA模块连接被拒绝错误(TLS手抖动误差)下载文件从JIRA服务器下载文件如何从JIRA服务器使用的NodeJS

我的代码的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

使用'的https原来的网址://',而不是'HTTP://'? – yjwong

+0

耶对不起,我现在编辑了错误的代码 – Labeo

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'));