0.1.4 • Published 9 years ago

watchree v0.1.4

Weekly downloads
3
License
MIT
Repository
-
Last release
9 years ago

watchree

A wrapper around fs.watch for recursively watching a directory of files.

Purpose

I found other file watchers such as

were either slow to start up or unreliable. I created watchtree to watch a project directory with more than 40,000 files; it initializes in under 500ms.

The only fast and reliable library I found was facebook/watchman, but I didn't like that it dependend on a separate service that had to be built and installed.

Install

npm install watchree --save-dev

Example

var watchTree = require('watchree');

watchTree(__dirname, {
    excludeFiles: /^hg-|(^|[\/\\])(\.|Thumbs\.db$|nohup\.out$)|___jb_(old|bak)___$|\.(pyc|tar\.gz|orig)$/,
    excludeDirs: /^(node_modules|bower_components|sql|artifacts|session|logs|cache|plugins\/ezc)$|(^|[\/\\])\./
})
    .on('ready', function(files) {
        console.log('watch initialized on '+files.length+' files');
    })
    .on('modify',function(files) {
        console.log('modify',files);
    })
    .on('create',function(files) {
        console.log('create',files);
    })
    .on('delete',function(files) {
        console.log('delete',files);
    })
    .on('all', function(files) {
        console.log('created, modified or deleted',files);
    });

License

watchree is made available under the terms of the MIT license. See the LICENSE file that accompanies this distribution for the full text of the license.

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago