Skip to content

Instantly share code, notes, and snippets.

@evilpacket
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save evilpacket/f9f065b2796e95528f00 to your computer and use it in GitHub Desktop.

Select an option

Save evilpacket/f9f065b2796e95528f00 to your computer and use it in GitHub Desktop.
// USAGE: node buf.js output_file buffer_size iteration
// Example: node buf.js derp 51200 1000
var fs = require('fs');
var file = process.argv[2];
var size = Number(process.argv[3]);
var thinger = [];
fs.open(file, 'w', function (err, fd) {
for (var i=0; i<process.argv[4];i++) {
var buf = new Buffer(size);
thinger.push[buf];
fs.writeSync(fd, buf, 0, buf.length);
}
fs.close(fd);
});
var express = require('express');
var app = express();
app.get('/test', function(req, res){
console.log(req.query);
res.send("HELLO LNUG");
});
var server = app.listen(3000, function() {
console.log('Listening on port %d', server.address().port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment