Skip to content

Instantly share code, notes, and snippets.

@friggeri
Created February 2, 2011 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save friggeri/808454 to your computer and use it in GitHub Desktop.
Save friggeri/808454 to your computer and use it in GitHub Desktop.
async writes
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