1.1.0 • Published 9 years ago

watch-files v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

watch-files

NPM version build status Test coverage David deps node version Gittip

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