{ "_args": [ [ { "raw": "monocle@1.1.51", "scope": null, "escapedName": "monocle", "name": "monocle", "rawSpec": "1.1.51", "spec": "1.1.51", "type": "version" }, "/Users/MB/git/pdfkit/node_modules/jade" ] ], "_from": "monocle@1.1.51", "_id": "monocle@1.1.51", "_inCache": true, "_location": "/monocle", "_npmUser": { "name": "samccone", "email": "samccone@gmail.com" }, "_npmVersion": "1.2.30", "_phantomChildren": {}, "_requested": { "raw": "monocle@1.1.51", "scope": null, "escapedName": "monocle", "name": "monocle", "rawSpec": "1.1.51", "spec": "1.1.51", "type": "version" }, "_requiredBy": [ "/jade" ], "_resolved": "https://registry.npmjs.org/monocle/-/monocle-1.1.51.tgz", "_shasum": "22ed16e112e9b056769c5ccac920e375249d89c0", "_shrinkwrap": null, "_spec": "monocle@1.1.51", "_where": "/Users/MB/git/pdfkit/node_modules/jade", "author": { "name": "Sam Saccone" }, "bugs": { "url": "https://github.com/samccone/monocle/issues" }, "dependencies": { "readdirp": "~0.2.3" }, "description": "a tool for watching directories for file changes", "devDependencies": { "mocha": "1.8.1" }, "directories": { "test": "test" }, "dist": { "shasum": "22ed16e112e9b056769c5ccac920e375249d89c0", "tarball": "https://registry.npmjs.org/monocle/-/monocle-1.1.51.tgz" }, "homepage": "https://github.com/samccone/monocle#readme", "keywords": [ "watch", "filesystem", "folders", "fs" ], "license": "BSD", "main": "monocle.js", "maintainers": [ { "name": "samccone", "email": "samccone@gmail.com" } ], "name": "monocle", "optionalDependencies": {}, "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: ,\n fileFilter: ,\n directoryFilter: ,\n listener: fn(fs.stat+ object), //triggered on file change / addition\n complete: //file watching all set up\n});\n```\n\nThe listener will recive an object with the following\n\n```js\n name: ,\n path: ,\n fullPath: ,\n parentDir: ,\n fullParentDir: ,\n stat: \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: , //triggered on file / addition\n complete: //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: , // `*.js` for example\n listener: , //triggered on file / addition\n complete: //file watching all set up\n});\n```\n\n### Force to use fs.watch\n\nYou can use the USE_FS_WATCH env variable set to true, to force this behavior regardless of platform.\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", "repository": { "type": "git", "url": "git+https://github.com/samccone/monocle.git" }, "scripts": { "test": "mocha test -R spec -t 2000" }, "version": "1.1.51" }