Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rksm/node-watch-interface
Interface for the node.js watch module.
https://github.com/rksm/node-watch-interface
Last synced: about 1 month ago
JSON representation
Interface for the node.js watch module.
- Host: GitHub
- URL: https://github.com/rksm/node-watch-interface
- Owner: rksm
- License: mit
- Created: 2014-01-06T20:47:04.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-04-04T04:43:34.000Z (over 9 years ago)
- Last Synced: 2024-10-13T10:25:57.913Z (3 months ago)
- Language: JavaScript
- Size: 191 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
https://www.npmjs.com/package/chokidar
# watch-interface
Recursively gather file meta data starting at a root directory. When files
change the meta data gets automatically updated. It is thin wrapper for [gaze](https://github.com/shama/gaze)
that takes care of some housekeeping and provides a non-changing interface when
we change the watching backend.## Usage
### `require('watch-interface').on(directory, options, callback)`
Starts watching a directory recursively.
- `directory`: String, root of what should be watched
- `options`: Object with
- `exclude`: Array of strings, regular expressions or functions that should
match if the particular file should be ignored.
- `callback`: gets err object and a `gazer`### `require('watch-interface').onFiles(directory, listOfFiles, options, callback)`
Like on but ignore all files except those that are in the list.
### `gazer.state`
- object with the fields
- `monitor`: gazer object from the `gaze` module
- `lastChange`: Date
- `startTime`: Date
- `changeList`: list of changes accrued since `startTime`, having the fields:
- `time`
- `path`
- `type`: one of `["creation", "removal", "change"]`### `gazer.getWatchedFiles(callback)`
Retrieve all the files being watched.
- `callback` is called with an error object and and array of files (file paths,
relative to the base directory being watched)### `gazer.getChangesSince(date, callback)`
Retrieve what changes happened since a given time.
- `date`: Request changes since. Date object or Number specifying a data. If null, returns all changes observed.
- `callback` is called with two args: `err` and `[{time,path,type}]` with type one of `['removal', 'creation', 'change']`### `gazer.close(callback)`
Stop watching.
- `callback`: gets err argument.
## License
[MIT](LICENSE)