{"dist":{"shasum":"644d0e91bd8515bc00ef78a8ac379578332e82b9","tarball":"https://registry.npmjs.org/monocle/-/monocle-0.1.43.tgz","integrity":"sha512-JQDW6J+mDEP7M8c0QjlLdUxybnGyqjUVo0+jrcrCh5NeEWA50vuQKHbJSaFGT/2G9E/BgDKmsMDK1fno4LvS4A==","signatures":[{"sig":"MEYCIQCIshqkVQ9h7w4MWn1IsX6ZmZJYUCnnWFsVFoxQfUm7UwIhAK4H919C5odxqaRtqiYGEAcwmtb+LLytmzbLaxf7tuEH","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"monocle.js","name":"monocle","author":{"name":"Sam Saccone"},"readme":"[![Build Status](https://travis-ci.org/samccone/monocle.png?branch=master)](https://travis-ci.org/samccone/monocle)\n\n# Monocle -- a tool for watching things\n\n[![logo](https://raw.github.com/samccone/monocle/master/logo.png)](https://raw.github.com/samccone/monocle/master/logo.png)\n\nHave you ever wanted to watch a folder and all of its files/nested folders for changes. well now you can!\n\n## Installation\n\n```\nnpm install monocle\n```\n\n## Usage\n\n### Watch a directory:\n\n```js\nvar monocle = require('monocle')()\nmonocle.watchDirectory({\n  root: <root directory>,\n  fileFilter: <optional>,\n  directoryFilter: <optional>,\n  listener: fn(fs.stat+ object), //triggered on file change / addition\n  complete: <fn> //file watching all set up\n});\n```\n\nThe listener will recive an object with the following\n\n```js\n  name: <filename>,\n  path: <filepath-relative>,\n  fullPath: <filepath-absolute>,\n  parentDir: <parentDir-relative>,\n  fullParentDir: <parentDir-absolute>,\n  stat: <see fs.stats>\n```\n\n[fs.stats](http://nodejs.org/api/fs.html#fs_class_fs_stats)\n\nWhen a new file is added to the directoy it triggers a file change and thus will be passed to your specified listener.\n\nThe two filters are passed through to `readdirp`.  More documentation can be found [here](https://github.com/thlorenz/readdirp#filters)\n\n### Watch a list of files:\n\n```js\nMonocle.watchFiles({\n  files: [], //path of file(s)\n  listener: <fn(fs.stat+ object)>, //triggered on file / addition\n  complete: <fn> //file watching all set up\n});\n```\n\n## Why not just use fs.watch ?\n\n  - file watching is really bad cross platforms in node\n  - you need to be smart when using fs.watch as compared to fs.watchFile\n  - Monocle takes care of this logic for you!\n  - windows systems use fs.watch\n  - osx and linux uses fs.watchFile\n\n\n## License\n\nBSD\n","license":"BSD","scripts":{"test":"mocha test -R spec -t 2000"},"_npmUser":{"name":"samccone","email":"samccone@gmail.com"},"keywords":["watch","filesystem","folders","fs"],"repository":"","_npmVersion":"1.2.0","description":"a tool for watching directories for file changes","directories":{"test":"test"},"maintainers":[{"name":"samccone","email":"samccone@gmail.com"}],"dependencies":{"readdirp":"~0.2.3"},"readmeFilename":"README.md","devDependencies":{"mocha":"1.8.1"},"_id":"monocle@0.1.43","version":"0.1.43"}