wtchr
Simple file/directory watcher. (Node.js)
API
It's quite simple to create a wtchr for a directory.
wtchr object
wtchr(path, [options]);
path
- an absolute dircetory path
options:
- persistent (boolean) default:
true
- interval (integer) default:
500
- ignore (regexp) default:
/(\/\.DS_Store$)/
Example:
var watch = ;
wtchr events
Wtchr provides simple event bindings. The event API is quite similar to jQuery events, so most of JS developers are familiar with it.
bind an event
.on(type, [selector], handler(path, curr lstat, prev lstat))
unbind an event
.off(type, [selector], [handler(path, curr lstat, prev lstat)])
type:
- one of the 3 supported types
create
/change
/delete
selector
- a minimatch path selector (simply a filter)
handle:
- a event handler
Example:
var watch = watch; watch;
Chaining:
;
stop wtchr
Simply destroy the wtchr object with the destroy method.
.destroy()
Example:
var watch = watch;