A minimal and efficient cross-platform file watching library for Node.js, improving upon native fs.watch.
Chokidar is a minimal and efficient cross-platform file watching library for Node.js that provides a reliable and normalized API for monitoring file and directory changes. It solves the inconsistencies and limitations of Node.js's native `fs.watch` and `fs.watchFile` by offering consistent event reporting across macOS, Windows, and Linux. The library is essential for build tools, development servers, and applications requiring real-time file updates.
Node.js developers building tools like bundlers, development servers, or any application that needs to react to file system changes in real time, especially those who need reliable cross-platform behavior. It is also suitable for developers working with network drives or editors that use atomic writes.
Developers choose Chokidar over native Node.js file watching because it normalizes events across operating systems, avoids duplicate events, and provides reliable filenames. Its unique selling points include support for atomic writes, chunked writes with configurable options, flexible filtering, and always-available recursive watching with performance optimizations that minimize CPU usage.
Minimal and efficient cross-platform file watching library
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Normalizes file events across macOS, Windows, and Linux, ensuring consistent filenames and avoiding duplicates that plague native fs.watch, as highlighted in the README's 'Why?' section.
Handles atomic writes and chunked writes with options like awaitWriteFinish, essential for large files or editor integrations, with configurable thresholds for stability.
Allows ignoring files using functions, regex, or paths with support for symbolic links, enabling precise control over watched directories without extra setup.
Defaults to efficient fs.watch to minimize CPU usage, with polling as an opt-in for network drives or special cases, balancing speed and compatibility.
Can exhaust system file handles leading to EMFILE and ENOSP errors, requiring external fixes like graceful-fs or OS tuning, which adds operational complexity.
For network drives or edge cases, must use polling (usePolling: true), which significantly increases CPU and resource usage compared to the default mode.
Version 4 removed glob support and increased Node.js requirements, forcing migration work for existing projects, and v5 is ESM-only, limiting backward compatibility.