0

i am trying to download a file from jira server but i am getting connection refused error(tls hand shake error) using request module are there any jira modules that i can use to download a file from jira server

My nodejs code:

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);
});
Labeo
  • 5,831
  • 13
  • 47
  • 77

1 Answers1

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'));
Labeo
  • 5,831
  • 13
  • 47
  • 77