watch-files
v1.1.0
Published
watch files by polling
Downloads
5
Maintainers
Readme
watch-files
watch files by polling
Installation
$ npm install watch-files --save
Usage
var Watcher = require('watch-file');
var watcher = Watcher({
interval: '1m'
});
watcher.add('file.txt');
watcher.add('file.json');
watcher.on('change', function (info) {
// info.path => resolved file path
// info.remove => false
// info.stat (file stat)
});
watcher.on('remove', function (info) {
// info.path => resolved file path
// info.remove => true
});
watcher.on('all', function (info) {
// info.path => resolved file path
// info.remove => false | true
});
watcher.on('error', function (err) {
// stat err
});
License
MIT