Skip to content
Yet another NodeJS library for watching FS trees
CoffeeScript JavaScript
Find file
New pull request
Latest commit c10a2af @andrewschaaf andrewschaaf Merge pull request #7 from tafa/license
Add MIT license

watch-tree yet another NodeJS FS-watching library. If it happens to suit your needs better than the others, enjoy!

The current implementation maintains a ring of paths (both files and dirs), and stats the next one every (--sample-rate=) ms.

More efficient implementations will be added eventually, including inotify (for Linux) and FSEvents (for Mac), with the appropriate one being compiled at (npm install)-time.

Your code won't notice the difference when that happens, but your battery life might.


npm install watch-tree

Command-line tool


watch-tree [[relative_]path]


cd ~/repos/watch-tree; watch-tree '--ignore=/\.'




The watcher returned by .watchTree is a NodeJS EventEmitter instance.

watcher = require('watch-tree').watchTree(path, {'sample-rate': 5});
watcher.on('fileDeleted', function(path) {
    console.log("Quoth the walrus: Noooo, they're deleting mah " + path + "!");


Event Callback Arguments
filePreexisted path, stats
fileCreated path, stats
fileModified path, stats
fileDeleted path

...where stats is a NodeJS fs.Stats instance.


# Install
git clone; cd node-watch-tree
npm link

# Develop
coffee -cwlo lib src

# Push
cake build && cake test
Something went wrong with that request. Please try again.