Created
February 2, 2011 21:14
-
-
Save friggeri/808454 to your computer and use it in GitHub Desktop.
async writes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'), | |
http = require('http'); | |
var out = fs.createWriteStream('some-file', {flags:'w',encoding:'utf8'}); | |
http.createServer(function(req, res){ | |
var buffer = []; | |
req.on('data', [].push.bind(buffer)).on('end', function(){ | |
out.write(data); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment