Skip to content

Instantly share code, notes, and snippets.

@raytiley
Created December 3, 2014 23:48
Show Gist options
  • Save raytiley/31e1c5b3b2cfa2c2d608 to your computer and use it in GitHub Desktop.
Save raytiley/31e1c5b3b2cfa2c2d608 to your computer and use it in GitHub Desktop.
Do some watching test
var fs = require('fs');
fs.watch('watch-me', function (event, filename) {
console.log('event is: ' + event);
if (filename) {
console.log('filename provided: ' + filename);
} else {
console.log('filename not provided');
}
});
setTimeout(doLink, 2000);
setTimeout(doJunction, 4000);
function doLink() {
fs.link('./watch-me/watch-me.txt', './destination/watch-me.txt');
console.log('Did Link');
}
function doJunction() {
fs.symlink('./watch-me', './destination/watch-me', 'junction');
console.log('did junction');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment