appcd-fswatcher
v2.0.7
Published
A filesystem watcher that actually works.
Downloads
32
Readme
appcd-fswatcher
A filesystem watcher that actually works.
Visit https://github.com/appcelerator/appc-daemon for more information.
Report issues to GitHub issues. Official issue tracker in JIRA.
Installation
npm i appcd-fswatcher
Usage
import FSWatcher from 'appcd-fswatcher';
const watcher = new FSWatcher('/path/to/watch', {
recursive: true,
depth: 2
});
watcher.on('change', evt => {
console.log(evt);
});
watcher.on('error', err => {
console.error(err);
});
To stop watching, you can call close()
:
watcher.close();
Extra functions:
import {
renderTree,
status
} from 'appcd-fswatcher';
// display an ascii tree of the filesystem tree that's being watched
console.log(renderTree());
// display filesystem watcher stats (as well as the tree)
console.log(status());
Legal
This project is open source under the Apache Public License v2 and is developed by
Axway, Inc and the community. Please read the LICENSE
file included
in this distribution for more information.