{"name":"gaze","description":"A globbing fs.watch wrapper built from the best parts of other fine watch libs.","version":"0.3.2","homepage":"https://github.com/shama/gaze","author":{"name":"Kyle Robinson Young","email":"kyle@dontkry.com"},"repository":{"type":"git","url":"git://github.com/shama/gaze.git"},"bugs":{"url":"https://github.com/shama/gaze/issues"},"licenses":[{"type":"MIT","url":"https://github.com/shama/gaze/blob/master/LICENSE-MIT"}],"main":"lib/gaze","engines":{"node":">= 0.6.0"},"scripts":{"test":"grunt nodeunit -v"},"dependencies":{"async":"~0.1.22","glob":"~3.1.14","lodash":"~0.10.0","minimatch":"~0.2.9"},"devDependencies":{"grunt":"~0.4.0rc4","grunt-contrib-nodeunit":"~0.1.1","grunt-contrib-jshint":"~0.1.0","grunt-contrib-watch":"~0.2.0","grunt-benchmark":"~0.1.1"},"keywords":["watch","glob"],"contributors":[{"name":"Kyle Robinson Young","url":"http://dontkry.com"},{"name":"Sam Day","url":"http://sam.is-super-awesome.com"},{"name":"Roarke Gaskill","url":"http://starkinvestments.com"}],"_id":"gaze@0.3.2","dist":{"shasum":"ffa34dbd11f57b2817bbf642b706a838ad58bd95","tarball":"http://registry-npm.ywwl.com/gaze/download/gaze-0.3.2.tgz","integrity":"sha512-1ZVJ+29y5VBk+hUMcAKkD/7u35xPH94CJKSKgevBi0n8jvBBnlQn4gz7A0mQ82lm3jqMy6iKTuM4exH5/e/swg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDirj/88N3ANLv0SUPCYxupTXIkdi6xWJyLiNYw5sZPjAiAlzaV8oRXx3195S5VqQq436jAxiSYykdITCtmKLSq0JQ=="}],"size":10496,"noattachment":false,"key":"/gaze/-/gaze-0.3.2.tgz"},"_npmVersion":"1.1.62","_npmUser":{"name":"shama","email":"kyle@dontkry.com"},"maintainers":[{"name":"shama","email":"kyle@dontkry.com"}],"directories":{},"readme":"# gaze [![Build Status](http://img.shields.io/travis/shama/gaze.svg)](https://travis-ci.org/shama/gaze) [![Build status](https://ci.appveyor.com/api/projects/status/vtx65w9eg511tgo4)](https://ci.appveyor.com/project/shama/gaze)\n\nA globbing `fs.watch` wrapper built from the best parts of other fine watch libs.  \nCompatible with Node.js >= 4.x, Windows, macOS, and Linux.\n\n![gaze](http://dontkry.com/images/repos/gaze.png)\n\n[![NPM](https://nodei.co/npm/gaze.png?downloads=true)](https://nodei.co/npm/gaze/)\n\n## Usage\nInstall the module with: `npm install gaze` or place into your `package.json`\nand run `npm install`.\n\n```javascript\nvar gaze = require('gaze');\n\n// Watch all .js files/dirs in process.cwd()\ngaze('**/*.js', function(err, watcher) {\n  // Files have all started watching\n  // watcher === this\n\n  // Get all watched files\n  var watched = this.watched();\n\n  // On file changed\n  this.on('changed', function(filepath) {\n    console.log(filepath + ' was changed');\n  });\n\n  // On file added\n  this.on('added', function(filepath) {\n    console.log(filepath + ' was added');\n  });\n\n  // On file deleted\n  this.on('deleted', function(filepath) {\n    console.log(filepath + ' was deleted');\n  });\n\n  // On changed/added/deleted\n  this.on('all', function(event, filepath) {\n    console.log(filepath + ' was ' + event);\n  });\n\n  // Get watched files with relative paths\n  var files = this.relative();\n});\n\n// Also accepts an array of patterns\ngaze(['stylesheets/*.css', 'images/**/*.png'], function() {\n  // Add more patterns later to be watched\n  this.add(['js/*.js']);\n});\n```\n\n### Alternate Interface\n\n```javascript\nvar Gaze = require('gaze').Gaze;\n\nvar gaze = new Gaze('**/*');\n\n// Files have all started watching\ngaze.on('ready', function(watcher) { });\n\n// A file has been added/changed/deleted has occurred\ngaze.on('all', function(event, filepath) { });\n```\n\n### Errors\n\n```javascript\ngaze('**/*', function(error, watcher) {\n  if (error) {\n    // Handle error if it occurred while starting up\n  }\n});\n\n// Or with the alternative interface\nvar gaze = new Gaze();\ngaze.on('error', function(error) {\n  // Handle error here\n});\ngaze.add('**/*');\n```\n\n### Minimatch / Glob\n\nSee [isaacs's `minimatch`](https://github.com/isaacs/minimatch) for more\ninformation on glob patterns.\n\n## Documentation\n\n### gaze([patterns, options, callback])\n\n* `patterns` {`String`|`Array`} File patterns to be matched\n* `options` {`Object`}\n* `callback` {`Function`}\n  * `err` {`Error` | `null`}\n  * `watcher` {`Object`} Instance of the `Gaze` watcher\n\n### Class: `gaze.Gaze`\n\nCreate a `Gaze` object by instancing the `gaze.Gaze` class.\n\n```javascript\nvar Gaze = require('gaze').Gaze;\nvar gaze = new Gaze(pattern, options, callback);\n```\n\n#### Properties\n\n* `options` The options object passed in.\n  * `interval` {integer} Interval to pass to `fs.watchFile`\n  * `debounceDelay` {integer} Delay for events called in succession for the same\n    file/event in milliseconds\n  * `mode` {string} Force the watch mode. Either `'auto'` (default), `'watch'` (force native events), or `'poll'` (force stat polling).\n  * `cwd` {string} The current working directory to base file patterns from. Default is `process.cwd()`.\n\n#### Events\n\n* `ready(watcher)` When files have been globbed and watching has begun.\n* `all(event, filepath)` When an `added`, `changed`, `renamed`, or `deleted` event occurs.\n* `added(filepath)` When a file has been added to a watch directory.\n* `changed(filepath)` When a file has been changed.\n* `deleted(filepath)` When a file has been deleted.\n* `renamed(newPath, oldPath)` When a file has been renamed.\n* `end()` When the watcher is closed and watches have been removed.\n* `error(err)` When an error occurs.\n* `nomatch` When no files have been matched.\n\n#### Methods\n\n* `emit(event, [...])` Wrapper for `EventEmitter.emit`.\n  `added`|`changed`|`renamed`|`deleted` events will also trigger the `all` event.\n* `close()` Unwatch all files and reset the watch instance.\n* `add(patterns, callback)` Adds file(s) `patterns` to be watched.\n* `remove(filepath)` Removes a file or directory from being watched. Does not\n  recurse directories.\n* `watched()` Returns the currently watched files.\n* `relative([dir, unixify])` Returns the currently watched files with relative paths.\n  * `dir` {string} Only return relative files for this directory.\n  * `unixify` {boolean} Return paths with `/` instead of `\\\\` if on Windows.\n\n## Similar Projects\n\nOther great watch libraries to try are:\n\n* [paulmillr's `chokidar`](https://github.com/paulmillr/chokidar)\n* [amasad's `sane`](https://github.com/amasad/sane)\n* [mikeal's `watch`](https://github.com/mikeal/watch)\n* [github's `pathwatcher`](https://github.com/atom/node-pathwatcher)\n* [bevry's `watchr`](https://github.com/bevry/watchr)\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style.\nAdd unit tests for any new or changed functionality. Lint and test your code\nusing [grunt](http://gruntjs.com/).\n\n## Release History\n* 1.1.3 - Fix for Node 10 support (@aredridel). Officially dropping support for Node < 4.\n* 1.1.2 - Prevent more `ENOENT` errors from escaping (@alexgorbatchev).\n* 1.1.1 - Prevent `fs.watch` errors from escaping error handler (@rosen-vladimirov). Fix `_addToWatched` without `path.sep` (@wyicwx).\n* 1.1.0 - Update to `globule@1.0.0` with `minimatch >= 3.0.0`.\n* 1.0.0 - Revert back to 0.5.2. Drop support for Node.js v0.8. Fix for `maxListeners`. Update `globule` to `0.2.0`.\n* 0.6.4 - Catch and emit `error` from `readdir` (@oconnore). Fix for `0 maxListeners`. Use `graceful-fs` to avoid `EMFILE` errors in other places `fs` is used. Better method to determine if `pathwatcher` was built. Fix keeping process alive too much, only init `pathwatcher` if a file is being watched. Set min required to Windows Vista when building on Windows (@pvolok).\n* 0.6.3 - Add support for Node.js v0.11\n* 0.6.2 - Fix argument error with `watched()`. Fix for erroneous `added` events on folders. Ignore `msvs` build error 4244.\n* 0.6.1 - Fix for absolute paths.\n* 0.6.0 - Uses native OS events (fork of `pathwatcher`) but can fall back to stat polling. Everything is async to avoid blocking, including `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.\n* 0.5.2 - Fix for `ENOENT` error with non-existent symlinks [BACKPORTED].\n* 0.5.1 - Use `setImmediate` (`process.nextTick` for Node.js v0.8) to defer `ready`/`nomatch` events (@amasad).\n* 0.5.0 - Process is now kept alive while watching files. Emits a `nomatch` event when no files are matching.\n* 0.4.3 - Track file additions in newly created folders (@brett-shwom).\n* 0.4.2 - Fix `.remove()` method to remove a single file in a directory (@kaelzhang). Fixing “`Cannot call method 'call' of undefined`” (@krasimir). Track new file additions within folders (@brett-shwom).\n* 0.4.1 - Fix `watchDir` not respecting close in race condition (@chrisirhc).\n* 0.4.0 - Drop support for Node.js v0.6. Use `globule` for file matching. Avoid Node.js v0.10 `path.resolve`/`join` errors. Register new files when added to non-existent folder. Multiple instances can now poll the same files (@jpommerening).\n* 0.3.4 - Code clean up. Fix “`path must be strings`” errors (@groner). Fix incorrect `added` events (@groner).\n* 0.3.3 - Fix for multiple patterns with negate.\n* 0.3.2 - Emit `end` before `removeAllListeners`.\n* 0.3.1 - Fix `added` events within subfolder patterns.\n* 0.3.0 - Handle safewrite events, `forceWatchMethod` option removed, bug fixes and watch optimizations (@rgaskill).\n* 0.2.2 - Fix issue where subsequent `add` calls dont get watched (@samcday). `removeAllListeners` on `close`.\n* 0.2.1 - Fix issue with invalid `added` events in current working dir.\n* 0.2.0 - Support and mark folders with `path.sep`. Add `forceWatchMethod` option. Support `renamed` events.\n* 0.1.6 - Recognize the `cwd` option properly\n* 0.1.5 - Catch “`too many open file`” errors\n* 0.1.4 - Really fix the race condition with 2 watches\n* 0.1.3 - Fix race condition with 2 watches\n* 0.1.2 - Read triggering changed event fix\n* 0.1.1 - Minor fixes\n* 0.1.0 - Initial release\n\n## License\nCopyright (c) 2018 Kyle Robinson Young  \nLicensed under the MIT license.\n","publish_time":1357588280554,"_cnpm_publish_time":1357588280554,"dist-tags":{"latest":"1.1.3"}}