{ "_args": [ [ { "raw": "sane@^2.0.0", "scope": null, "escapedName": "sane", "name": "sane", "rawSpec": "^2.0.0", "spec": ">=2.0.0 <3.0.0", "type": "range" }, "/home/jdaugherty/work/GT2/GT2-Android/node_modules/jest-haste-map" ] ], "_from": "sane@>=2.0.0 <3.0.0", "_id": "sane@2.4.1", "_inCache": true, "_location": "/sane", "_nodeVersion": "8.9.0", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/sane_2.4.1_1518108649258_0.3142059003506539" }, "_npmUser": { "name": "stefanpenner", "email": "stefan.penner@gmail.com" }, "_npmVersion": "5.6.0", "_phantomChildren": {}, "_requested": { "raw": "sane@^2.0.0", "scope": null, "escapedName": "sane", "name": "sane", "rawSpec": "^2.0.0", "spec": ">=2.0.0 <3.0.0", "type": "range" }, "_requiredBy": [ "/jest-haste-map", "/jest-runner/jest-haste-map", "/jest-runtime/jest-haste-map", "/jest/jest-haste-map" ], "_resolved": "https://registry.npmjs.org/sane/-/sane-2.4.1.tgz", "_shasum": "29f991208cf28636720efdc584293e7fd66663a5", "_shrinkwrap": null, "_spec": "sane@^2.0.0", "_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/jest-haste-map", "author": { "name": "amasad" }, "bin": { "sane": "./src/cli.js" }, "bugs": { "url": "https://github.com/amasad/sane/issues" }, "dependencies": { "anymatch": "^1.3.0", "exec-sh": "^0.2.0", "fb-watchman": "^2.0.0", "fsevents": "^1.1.1", "minimatch": "^3.0.2", "minimist": "^1.1.1", "walker": "~1.0.5", "watch": "~0.18.0" }, "description": "Sane aims to be fast, small, and reliable file system watcher.", "devDependencies": { "eslint": "^3.19.0", "mocha": "~1.17.1", "prettier": "^1.3.1", "rimraf": "~2.2.6", "tmp": "0.0.27" }, "directories": {}, "dist": { "integrity": "sha512-fW9svvNd81XzHDZyis9/tEY1bZikDGryy8Hi1BErPyNPYv47CdLseUN+tI5FBHWXEENRtj1SWtX/jBnggLaP0w==", "shasum": "29f991208cf28636720efdc584293e7fd66663a5", "tarball": "https://registry.npmjs.org/sane/-/sane-2.4.1.tgz", "fileCount": 11, "unpackedSize": 48393 }, "engines": { "node": ">=0.6.0" }, "files": [ "src", "index.js" ], "gitHead": "ec657e41e93db7c524a4110c024c3d5f34c9440c", "homepage": "https://github.com/amasad/sane", "keywords": [ "watch", "file", "fswatcher", "watchfile", "fs", "watching" ], "license": "MIT", "main": "index.js", "maintainers": [ { "name": "amasad", "email": "amjad.masad@gmail.com" }, { "name": "stefanpenner", "email": "stefan.penner@gmail.com" } ], "name": "sane", "optionalDependencies": { "fsevents": "^1.1.1" }, "readme": "[![CircleCI](https://circleci.com/gh/amasad/sane.svg?style=svg)](https://circleci.com/gh/amasad/sane)\n\nsane\n----\n\nI've been driven to insanity by node filesystem watcher wrappers.\nSane aims to be fast, small, and reliable file system watcher. It does that by:\n\n* By default stays away from fs polling because it's very slow and cpu intensive\n* Uses `fs.watch` by default and sensibly works around the various issues\n* Maintains a consistent API across different platforms\n* Where `fs.watch` is not reliable you have the choice of using the following alternatives:\n * [the facebook watchman library](https://facebook.github.io/watchman/)\n * polling\n\n## Install\n\n```\n$ npm install sane\n```\n\n## How to choose a mode\n\nDon't worry too much about choosing the correct mode upfront because sane\nmaintains the same API across all modes and will be easy to switch.\n\n* If you're only supporting Linux and OS X, `watchman` would be the most reliable mode\n* If you're using node > v0.10.0 use the default mode\n* If you're running OS X and you're watching a lot of directories and you're running into https://github.com/joyent/node/issues/5463, use `watchman`\n* If you're in an environment where native file system events aren't available (like Vagrant), you should use polling\n* Otherwise, the default mode should work well for you\n\n## API\n\n### sane(dir, options)\n\nWatches a directory and all its descendant directories for changes, deletions, and additions on files and directories.\n\n```js\nvar watcher = sane('path/to/dir', {glob: ['**/*.js', '**/*.css']});\nwatcher.on('ready', function () { console.log('ready') });\nwatcher.on('change', function (filepath, root, stat) { console.log('file changed', filepath); });\nwatcher.on('add', function (filepath, root, stat) { console.log('file added', filepath); });\nwatcher.on('delete', function (filepath, root) { console.log('file deleted', filepath); });\n// close\nwatcher.close();\n```\n\noptions:\n\n* `glob`: a single string glob pattern or an array of them.\n* `poll`: puts the watcher in polling mode. Under the hood that means `fs.watchFile`.\n* `watchman`: makes the watcher use [watchman](https://facebook.github.io/watchman/).\n* `watchmanPath`: sets a custom path for `watchman` binary.\n* `dot`: enables watching files/directories that start with a dot.\n* `ignored`: a glob, regex, function, or array of any combination.\n\nFor the glob pattern documentation, see [minimatch](https://github.com/isaacs/minimatch).\nIf you choose to use `watchman` you'll have to [install watchman yourself](https://facebook.github.io/watchman/docs/install.html)).\nFor the ignored options, see [anymatch](https://github.com/es128/anymatch).\n\n### sane.NodeWatcher(dir, options)\n\nThe default watcher class. Uses `fs.watch` under the hood, and takes the same options as `sane(dir, options)`.\n\n### sane.WatchmanWatcher(dir, options)\n\nThe watchman watcher class. Takes the same options as `sane(dir, options)`.\n\n### sane.PollWatcher(dir, options)\n\nThe polling watcher class. Takes the same options as `sane(dir, options)` with the addition of:\n\n* interval: indicates how often the files should be polled. (passed to fs.watchFile)\n\n### sane.{Node|Watchman|Poll}Watcher#close\n\nStops watching.\n\n### sane.{Node|Watchman|Poll}Watcher events\n\nEmits the following events:\n\nAll events are passed the file/dir path relative to the root directory\n* `ready` when the program is ready to detect events in the directory\n* `change` when a file changes\n* `add` when a file or directory has been added\n* `delete` when a file or directory has been deleted\n\n## CLI\n\nThis module includes a simple command line interface, which you can install with `npm install sane -g`.\n\n```\nUsage: sane [...directory] [--glob=] [--poll] [--watchman] [--watchman-path=] [--dot] [--wait=]\n\nOPTIONS:\n --glob=\n A single string glob pattern or an array of them.\n\n --ignored=\n A glob, regex, function, or array of any combination.\n\n --poll, -p\n Use polling mode.\n\n --watchman, -w\n Use watchman (if available).\n\n --watchman-path=\n Sets a custom path for watchman binary (if using this mode).\n\n --dot, -d\n Enables watching files/directories that start with a dot.\n\n --wait=\n Duration, in seconds, that watching will be disabled\n after running . Setting this option will\n throttle calls to for the specified duration.\n```\n\nIt will watch the given `directory` and run the given every time a file changes.\n\n### CLI example usage\n- `sane 'echo \"A command ran\"'`\n- `sane 'echo \"A command ran\"' --glob='**/*.css'`\n- `sane 'echo \"A command ran\"' site/assets/css --glob='**/*.css'`\n- `sane 'echo \"A command ran\"' --glob='**/*.css' --ignored='**/ignore.css'`\n- `sane 'echo \"A command ran\"' --wait=3`\n- `sane 'echo \"A command ran\"' -p`\n\n## License\n\nMIT\n\n## Credits\nThe CLI was originally based on the [watch CLI](https://github.com/mikeal/watch). Watch is licensed under the Apache License Version 2.0.\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/amasad/sane.git" }, "scripts": { "format": "prettier --trailing-comma es5 --single-quote --write index.js 'src/**/*.js' 'test/**/*.js'", "test": "npm run format && eslint src/ test/ index.js && mocha --bail test/test.js && mocha --bail test/utils-test.js", "test:debug": "mocha debug --bail" }, "version": "2.4.1" }