-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
44 lines (44 loc) · 3.35 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
"name": "monocle",
"version": "1.1.51",
"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 2000"
},
"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### 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",
"homepage": "https://github.com/samccone/monocle",
"_id": "monocle@1.1.51",
"dist": {
"shasum": "22ed16e112e9b056769c5ccac920e375249d89c0"
},
"_from": "monocle@1.1.51",
"_resolved": "https://registry.npmjs.org/monocle/-/monocle-1.1.51.tgz"
}