0.1.1 • Published 10 years ago
watch-loop v0.1.1
watch-loop
recursively watch a directory.
Install
npm install watch-loop
Usage
loop(dirname | filename, options, fn)
dirname | filename: can be a directory or a file name
options (optional): the same as options in http://nodejs.org/api/fs.html#fs_fs_watch_filename_options_listener
callback function: with a
event
object as a argument. So you can listen tochange
andrename
method with a callback function easily.
Sample
loop('./', function(ev) {
ev.on('change', function(filename) {
console.log('changing ' + filename);
})
ev.on('rename', function(filename) {
console.log('rename a file')
})
})
License
MIT@chilijung