node.js - Cannot stream large files -



node.js - Cannot stream large files -

i have 2 node js servers , b, connects b files(large files). here's code utilize handle streams.

var downloadedamount = 0; stream.on('data', function (data) { if (buffer.isbuffer(data)) { downloadedamount += data.tostring('utf8').length; } else { downloadedamount += data.length; } if (!res.write(data)) { stream.pause(); } }); res.on('finish', function () { console.log("finish called"); sendusage(reqid, downloadedamount); // async db/network phone call }); stream.on("end", function () { console.log("end called"); res.end(); }); res.on("drain", function () { stream.resume(); });

it downloads files when it's single file beingness downloaded. problem when seek download multiple files (larger 300mb) increases load on servers, connections closed @ b , files stopped @ 124mb. can tell me doing wrong here?

update : problem in b server direct multiple downloads (requested browser) tend halt @ 124mb or so.

ok. seems problem altogether in different location. changed apache server settings( b server uses files to

enablesendfile on

now works.

node.js stream

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -