$ npm install monocle
Have you ever wanted to watch a folder and all of its files/nested folders for changes. well now you can!
npm install monocle
var monocle = require('monocle')()
monocle.watchDirectory({
root: <root directory>,
fileFilter: <optional>,
directoryFilter: <optional>,
listener: fn(fs.stat+ object), //triggered on file change / addition
complete: <fn> //file watching all set up
});
The listener will recive an object with the following
name: <filename>,
path: <filepath-relative>,
fullPath: <filepath-absolute>,
parentDir: <parentDir-relative>,
fullParentDir: <parentDir-absolute>,
stat: <see fs.stats>
When a new file is added to the directoy it triggers a file change and thus will be passed to your specified listener.
The two filters are passed through to readdirp. More documentation can be found here
Monocle.watchFiles({
files: [], //path of file(s)
listener: <fn(fs.stat+ object)>, //triggered on file / addition
complete: <fn> //file watching all set up
});
BSD
© 2010 - cnpmjs.org x YWFE | Home | YWFE