Answers for "download binary files in express"

0

download binary files in express

var options = {
    method: 'GET',
    host: 'localhost',
    port: port,
    path: '/file'
  };

var request = http.request(options, function(response) { 
  var data = []; 

  response.on('data', function(chunk) { 
    data.push(chunk); 
  }); 

  response.on('end', function() { 
    data = Buffer.concat(data); // do something with data 
  }); 
}); 

request.end();
Posted by: Guest on May-05-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language