これは私が持っているもので、順番に実行するとファイルがまだ存在しないため、エラーが発生し続けます。
writeStream が閉じられたときにアクションをトリガーするにはどうすればよいですか?
var fs = require('fs'), http = require('http');
http.createServer(function(req){
req.pipe(fs.createWriteStream('file'));
/* i need to read the file back, like this or something:
var fcontents = fs.readFileSync(file);
doSomethinWith(fcontents);
... the problem is that the file hasn't been created yet.
*/
}).listen(1337, '127.0.0.1');