Fast and reliable files watcher.
Fast and reliable Node.js files watcher.
There are zilions Node.js file watchers. No one is perfect. The most feature rich is probably gaze, but it burns CPU because it uses pooling fs.watchFile. This watcher uses only fs.watch so it has limited functionality (can't detect deleted files), but it works. And it's fast even for thousands of files. Read more here and here.
Create a watcher to watch all files in the directories "foo" and "bar":
// Relative path to file that was changed or createdconsole.logfilefilepath;// File Extensionconsole.logfileextension;var esteWatch = require'este-watch';var watcher = esteWatch'foo' 'bar' onWatch;// Start the watcherwatcherstart
A third argument can be passed to the esteWatch function to specify options.
Three options are available:
esteWatch'foo' 'bar' onWatchfilter: /\.js$/ignoreFiles: /\.min\.js$/ignoreDirectories: /node_modules/start;