watch-files

1.1.0 • Public • Published

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

Package Sidebar

Install

npm i watch-files

Weekly Downloads

0

Version

1.1.0

License

MIT

Last publish

Collaborators

  • dead_horse