/file-change-watcher

Watches after file changes and reads the content appended to the file if any. Can be used to keep an eye on log files that are likely to change so to get the content that has been added to the file.

Primary LanguageJavaScript

file-change-watcher

Installation:

npm install file-change-watcher

Example of usage:

var fcw = require('file-change-watcher')
// ..	
fcw.watchFileChange('test.txt', function(err, data, fileSizeDiff, mtime) {
      console.log('err:', err, // null if no error
                  'data:', data, // content that has been added 
                                 //  to the watched file(null if fileSizeDiff <= 0)
                  'fileSizeDiff:', fileSizeDiff, // difference between current and
                                                 //  past file size
                  'mtime:', mtime); // Modification time
});