watch directory change, emit events including create, change, mv, remove, mkdir, mvdir, rmdir as exactly as there is
#Node-watch A fs.watch wrapper to watch files or directories(recursively by default).
npm install node-watch
var watch = require'node-watch';watch'somedir_or_somefile'console.logfilename ' changed.';;
This module currently does not differentiate event like
delete. Once there is a change, the callback function will be triggered.
recursive:Watch it recursively or not (defaults to true).
followSymLinks: Follow symbolic links or not (defaults to false).
maxSymLevel: The max number of following symbolic links, in order to prevent circular links (defaults to 1).
watch'somedir' recursive: false followSymLinks: trueconsole.logfilename ' changed.';;
Write your own filter function as a higher-order function. For example:
varreturnif patterntestfilenamefnfilename;// only watch for js fileswatch'mydir' filter/\.js$///;