Skip to content

Instantly share code, notes, and snippets.

@tanepiper tanepiper/output.json Secret
Created May 11, 2012

Embed
What would you like to do?
~/Desktop/watcher ᐅ node watcher.js
changed dir1/foo.js { dev: 234881026,
ino: 28080199,
mode: 33188,
nlink: 1,
uid: 501,
gid: 20,
rdev: 0,
size: 0,
blksize: 4096,
blocks: 0,
atime: Fri, 11 May 2012 22:29:48 GMT,
mtime: Fri, 11 May 2012 22:29:48 GMT,
ctime: Fri, 11 May 2012 22:29:48 GMT } { dev: 234881026,
ino: 28080199,
mode: 33188,
nlink: 1,
uid: 501,
gid: 20,
rdev: 0,
size: 0,
blksize: 4096,
blocks: 0,
atime: Fri, 11 May 2012 22:29:00 GMT,
mtime: Fri, 11 May 2012 22:29:00 GMT,
ctime: Fri, 11 May 2012 22:29:00 GMT }
created dir1/bar.js { dev: 234881026,
ino: 28082979,
mode: 33188,
nlink: 1,
uid: 501,
gid: 20,
rdev: 0,
size: 0,
blksize: 4096,
blocks: 0,
atime: Fri, 11 May 2012 22:30:05 GMT,
mtime: Fri, 11 May 2012 22:30:05 GMT,
ctime: Fri, 11 May 2012 22:30:05 GMT }
created dir1/bar.js { dev: 234881026,
ino: 28082979,
mode: 33188,
nlink: 1,
uid: 501,
gid: 20,
rdev: 0,
size: 0,
blksize: 4096,
blocks: 0,
atime: Fri, 11 May 2012 22:30:05 GMT,
mtime: Fri, 11 May 2012 22:30:05 GMT,
ctime: Fri, 11 May 2012 22:30:05 GMT }
var watch = require('watch');
var dnode = require('dnode');
watch.createMonitor('./dir1', function(monitor) {
monitor.on('created', function(f, stat) {
console.log('created', f, stat);
});
monitor.on('changed', function(f, curr, prev) {
console.log('changed', f, curr, prev);
});
monitor.on('removed', function(f, stat) {
console.log('removed', f, stat);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.