finds.dev← search

// the find

mikeal/watch

★ 1,278 · JavaScript · Apache-2.0 · updated Jan 2023

Utilities for watching file trees in node.js

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.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →