finds.dev

mikeal/watch

Utilities for watching file trees in node.js

View on GitHub

★ 1,278JavaScriptApache-2.0updated Jan 2023

// the take

A file tree watcher for Node.js that wraps `fs.watchFile` with recursive directory walking and an EventEmitter-based monitor API. It predates the native `fs.watch`/`chokidar` era and has been effectively unmaintained since 2013 despite occasional dependency bumps. If you need something to watch files in Node, you almost certainly want chokidar instead.

The `createMonitor` EventEmitter API is clean — `created`, `changed`, `removed` events with stat objects cover the common cases without ceremony. The filter option accepting a plain function is flexible and doesn't force you into glob patterns. The CLI is genuinely useful for simple watch-and-run tasks in one line without pulling in a task runner.

Polling via `fs.watchFile` under the hood means it's slow and hammers the disk on large trees — this is a fundamental design choice, not a fixable bug. No support for `fs.watch` (inotify/FSEvents), so you get no near-instant notifications. Last real commit was around 2013; chokidar solves all of this and is actively maintained. The callback signature for `watchTree` — where `null, null` means 'I finished initializing' — is a footgun that bites everyone on first use.

We read the README, the directory tree and a key source file in July 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
1,278
Forks
149
Language
JavaScript
License
Apache-2.0
Last commit
22 Jan 2023

// nearby

If watch isn't quite it.

All repos →