JSPM

  • Created
  • Published
  • Downloads 856550
  • Score
    100M100P100Q172828F

fs.watch() wrapper of Nodejs

Package Exports

  • node-watch

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-watch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

#Node-watch

There are 3 problems when using the native fs.watch() function of Nodejs:

  1. It won't watch a directory recursively.
  2. When modifying a file inside a watched directory, the callback function will be triggered multiple times.
  3. when modifying a watched file with an editor like vim, the callback function will only be triggered one time and then it is unwatched.

And this module is trying to solve those problems.

(In current version it does not differentiate event like "rename" or "delete". Once there is a change, the callback function will be triggered.)

Installation

npm install node-watch

Example

var watch = require('node-watch');

watch('somedir', function(filename) {
  console.log(filename, ' changed.');
});