// the find
isaacs/node-graceful-fs
fs with incremental backoff on EMFILE
A drop-in replacement for Node's `fs` module that queues `open` and `readdir` calls when EMFILE hits, retrying them as file descriptors free up. It also smooths over a handful of cross-platform rough edges — EAGAIN on reads, EACCESS on Windows renames, chown permission errors on non-root. Used by npm and most of the Node tooling ecosystem.
The EMFILE queue is the right fix: instead of crashing under descriptor pressure, it degrades gracefully by serializing opens. The monkey-patch opt-in model (v4+) is a good call — libraries can use it surgically without corrupting global state for everyone else. Windows rename retry logic is genuinely useful for anyone dealing with antivirus file locking. Test coverage is solid and covers the specific failure modes the library exists to handle.
Sync methods are explicitly unsupported for EMFILE/ENFILE — if your codebase uses `readFileSync` or `openSync` under load you get nothing from this. The queue is a global singleton, so if two independent parts of an app both use graceful-fs heavily, they share a single backpressure queue in ways that may be surprising. At this point it's essentially legacy infrastructure: Node's own ulimit handling and streams have improved significantly since this was written, and new projects probably don't need it. The README still references Node 0.8–7.0 compatibility as a selling point.