Skip to content

Instantly share code, notes, and snippets.

@piscisaureus
Created January 24, 2012 14:08
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 piscisaureus/1670344 to your computer and use it in GitHub Desktop.
Save piscisaureus/1670344 to your computer and use it in GitHub Desktop.
var fs = require('fs');
var buf = new Buffer(1024*1024);
buf.fill(42);
var fd = fs.openSync('file1', 'a+');
console.log("fd A: " + fd);
for (i = 0; i < 100; i++) {
fs.write(fd, buf, 0, buf.length, i * buf.length, function(err) {
if (err) console.log(err);
});
}
fs.closeSync(fd);
var fd2 = fs.openSync('file2', 'a+');
console.log("fd B: " + fd2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment