I'm trying to write two files and some more text to a response. The code below does however only return the first file and the "Thats all!" text.
var http = require('http'),
util = require('util'),
fs = require('fs');
server = http.createServer(function(req, res){
var stream = fs.createReadStream('one.html'),
stream2 = fs.createReadStream('two.html');
stream.on('end', function(){
stream2.pipe(res, { end:false});
});
stream2.on('end', function(){
res.end("Thats all!");
});
res.writeHead(200, {'Content-Type' : 'text/plain'});
stream.pipe(res, { end:false});
}).listen(8001);