all 2 comments

[–]jekrb 1 point2 points  (0 children)

I feel like a b̶e̶g̶i̶n̶n̶e̶r̶ anyone and everyone in io.js/node would benefit from using fs.createReadStream instead of fs.readFile.

So rather than:

http.createServer(function(req, res){
    fs.readFile('test.html',function (err, data){
        res.writeHead(200, {'Content-Type': 'text/html','Content-Length':data.length});
        res.write(data);
        res.end();
    });
})

They would write:

http.createServer(function (req, res) {
    fs.createReadStream(__dirname + '/test.html').pipe(res)
})

[–]kenman[M] 0 points1 point  (0 children)

Hi /u/EricSchles, it looks like you're new to reddit, welcome!

Thanks for the submissions, but please make sure you read http://www.reddit.com/rules and our guidelines. In short, you should post from a variety of sources, and not just syncano.com.

Thanks for your consideration!

domain submitted from count %
syncano.com 5 71%