A globbing fs.watch wrapper built from the best parts of other fine watch libs.
A globbing fs.watch wrapper built from the best parts of other fine watch libs.
Compatible with Node.js 4.x/0.12/0.10, Windows, OSX and Linux.

Install the module with: npm install gaze or place into your package.json
and run npm install.
var gaze = ; // Watch all .js files/dirs in process.cwd() ; // Also accepts an array of patterns ;var Gaze = Gaze; var gaze = '**/*'; // Files have all started watching gaze; // A file has been added/changed/deleted has occurred gaze;; // Or with the alternative interface var gaze = ;gaze;gaze;See isaacs's minimatch for more information on glob patterns.
patterns {String|Array} File patterns to be matchedoptions {Object}callback {Function}
err {Error | null}watcher {Object} Instance of the Gaze watcherCreate a Gaze object by instancing the gaze.Gaze class.
var Gaze = Gaze;var gaze = pattern options callback;options The options object passed in.
interval {integer} Interval to pass to fs.watchFiledebounceDelay {integer} Delay for events called in succession for the same
file/event in millisecondsmode {string} Force the watch mode. Either 'auto' (default), 'watch' (force native events), or 'poll' (force stat polling).cwd {string} The current working directory to base file patterns from. Default is process.cwd().ready(watcher) When files have been globbed and watching has begun.all(event, filepath) When an added, changed or deleted event occurs.added(filepath) When a file has been added to a watch directory.changed(filepath) When a file has been changed.deleted(filepath) When a file has been deleted.renamed(newPath, oldPath) When a file has been renamed.end() When the watcher is closed and watches have been removed.error(err) When an error occurs.nomatch When no files have been matched.emit(event, [...]) Wrapper for the EventEmitter.emit.
added|changed|deleted events will also trigger the all event.close() Unwatch all files and reset the watch instance.add(patterns, callback) Adds file(s) patterns to be watched.remove(filepath) removes a file or directory from being watched. Does not
recurse directories.watched() Returns the currently watched files.relative([dir, unixify]) Returns the currently watched files with relative paths.
dir {string} Only return relative files for this directory.unixify {boolean} Return paths with / instead of \\ if on Windows.Other great watch libraries to try are:
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.
globule@1.0.0 with minimatch >= 3.0.0.maxListeners. Update globule to 0.2.0.relative() and watched(). Better error handling. Update to globule@0.2.0. No longer watches cwd by default. Added mode option. Better EMFILE message. Avoids ENOENT errors with symlinks. All constructor arguments are optional.end before removeAllListeners.forceWatchMethod option removed, bug fixes and watch optimizations (@rgaskill).added events in current working dir.path.sep. Add forceWatchMethod option. Support renamed events.cwd option properlyCopyright (c) 2015 Kyle Robinson Young
Licensed under the MIT license.