JSPM

  • Created
  • Published
  • Downloads 856550
  • Score
    100M100P100Q172883F

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

This module will watch a directory recursively by default while trying to solve several problems caused by the native fs.watch():

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

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_or_somefile', function(filename) {
  console.log(filename, ' changed.');
});