https://github.com/Pita/etherpad-lite/blob/master/node/server.js#L74
This is a bad idea because you're not sending any data to the request until the entire file is read. You could use the fs.createReadStream() and .pipe() APIs directly:
http://nodejs.org/docs/v0.4.7/api/fs.html#fs.createReadStream
http://nodejs.org/docs/v0.4.7/api/streams.html#stream.pipe
Or better yet, I would suggest using node-static instead. This is a battle-hardened static file server for node.js that we use everyday in production at Nodejitsu.
https://github.com/cloudhead/node-static
https://github.com/Pita/etherpad-lite/blob/master/node/server.js#L74
This is a bad idea because you're not sending any data to the request until the entire file is read. You could use the
fs.createReadStream()and.pipe()APIs directly:http://nodejs.org/docs/v0.4.7/api/fs.html#fs.createReadStream
http://nodejs.org/docs/v0.4.7/api/streams.html#stream.pipe
Or better yet, I would suggest using
node-staticinstead. This is a battle-hardened static file server for node.js that we use everyday in production at Nodejitsu.https://github.com/cloudhead/node-static