Skip to content

Instantly share code, notes, and snippets.

@indutny

indutny/1.js Secret

Created August 14, 2013 10:54
Show Gist options
  • Save indutny/2ccdd6cee4b97ddbefbb to your computer and use it in GitHub Desktop.
Save indutny/2ccdd6cee4b97ddbefbb to your computer and use it in GitHub Desktop.
var fs = require('fs');
var filename = './1.txt';
function test() {
process.stdout.write('.');
fs.writeFileSync(filename, 'almost empty');
var watch = fs.watch(filename, function(event, filename) {
watch.close();
test();
});
setTimeout(function() {
fs.unlinkSync(filename);
}, 100);
}
test();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment