{"name":"monocle","version":"1.1.50","description":"a tool for watching directories for file changes","main":"monocle.js","directories":{"test":"test"},"dependencies":{"readdirp":"~0.2.3"},"devDependencies":{"mocha":"1.8.1"},"scripts":{"test":"mocha test -R spec -t 5000"},"repository":{"type":"git","url":"https://github.com/samccone/monocle.git"},"bugs":{"url":"https://github.com/samccone/monocle/issues"},"keywords":["watch","filesystem","folders","fs"],"author":{"name":"Sam Saccone"},"license":"BSD","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### Just watch path\n\nJust an alias of `watchFiles` and `watchDirectory` so you don't need to tell if that's a file or a directory by yourself. Parameter passed to `path` can be a `string` or a `array` of `string`.\n\n```js\nMonocle.watchPaths({\n  path: [], //list of paths, or a string of path\n  fileFilter: <optional>, // `*.js` for example\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## License\n\nBSD\n","readmeFilename":"README.md","_id":"monocle@1.1.50","dist":{"shasum":"e21b059d99726d958371f36240c106b8a067fa7d","tarball":"http://registry-npm.ywwl.com/monocle/download/monocle-1.1.50.tgz","integrity":"sha512-vwHHIM9xp6ARQ82nvZSLMlVUI42BHJIxc4DYGEiKo192fryV1Dr7aWmVwPhDNlbawrmrT/GrGUYMYO50AyRMcw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICuBQ1JqsYC+W0l1IoLK6uo/nxQH5ZvrhOcxxWdlBK/tAiEAtyeZs7JA/pE6qvwiP34UFWx67pALntqC/wswWnZ0q9E="}],"size":31144,"noattachment":false,"key":"/monocle/-/monocle-1.1.50.tgz"},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"samccone","email":"samccone@gmail.com"},"maintainers":[{"name":"samccone","email":"samccone@gmail.com"}],"publish_time":1371772164925,"_cnpm_publish_time":1371772164925,"dist-tags":{"latest":"1.1.51"}}