Skip to content

Instantly share code, notes, and snippets.

@ry
Created November 21, 2011 21:12
Show Gist options
  • Save ry/1383951 to your computer and use it in GitHub Desktop.
Save ry/1383951 to your computer and use it in GitHub Desktop.
% curl http://localhost:8000/ > outf
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1024M 100 1024M 0 0 20.2M 0 0:00:50 0:00:50 --:--:-- 19.8M
%
// dd if=/dev/zero of=bigfile bs=1024 count=1048576
var http = require('http');
var fs = require('fs');
var stat = fs.statSync('bigfile');
console.log(stat);
var s = http.Server(function(req, res) {
res.writeHead(200, {
'Content-Length': stat.size
});
fs.ReadStream('bigfile').pipe(res);
});
s.listen(8000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment