Monday, 15 May 2017

NODE JS http.get download large files

I'm having a problem trying to download files bigger than 256mb. I need to download a 1.2gb zip file, I need to understand if it's an apache or node limitation and how to solve it?(I have changed the apache's config files but still got the same problem).

This is the code, it works ok if I download a file smaller than 256mb.:

var req = http.get('http://localhost/web.zip', function(res) {
 var fileSize = res.headers['content-length'];
 res.setEncoding('binary');
 var a = "";
 res.on('data', function(chunk) {
     a += chunk;
     //SHOWS PROGRESS
 });
 res.on('end', function() {
     //DO SOMETHING AFTER DOWNLOADED
 });
});



via hell

No comments:

Post a Comment