1. License
“to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software”
MIT allows use in paid and closed-source products.
github.com/paulmillr/chokidar/blob/main/LICENSE3. Used by agents' projects
Dependency in 107 public GitHub projects set up for AI coding agents that we scanned (1.7%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily; card checked Nov 11, 2026. Tap a verdict to see its source.How we checkedReport an error
What chokidar does
chokidar is a free library for Node.js programs that watches files and folders. It tells your program when a file is added, changed or removed, so a build can rerun or a page can reload the moment you save. It behaves the same on Windows, Mac and Linux.
What people build with it
Rebuild when source files change
Your build or dev script reruns as soon as you save a file in src, and skips hidden files and other files you do not care about.
Process files dropped into a folder
Customers or a scanner drop files into an inbox folder; your app picks each one up only after it has finished copying.
Watch a network or shared drive
Files live on a network share or an unusual drive where normal change alerts are unreliable; chokidar can check them on a timer instead.
Survive editors that save in two steps
Some editors save by writing a temporary file and renaming it. chokidar reports this as one change instead of a delete and a new file.
Keep an AI agent's file index fresh Idea
Your coding agent keeps a search index of a project; when a file changes, only that file is read and indexed again.
Reload a docs preview on save Idea
A small preview server for Markdown docs refreshes the browser page whenever a writer saves a page.
chokidar popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How chokidar is used
- chokidar is a dependency in 107 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (2.2% of the 4,867 JavaScript/TypeScript ones), #18 of 299 in dev workflow and config.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 248; those are left out of every share on this page.
- The most used alternative in our scan is nodemon (94 projects).
- Projects that use it most often also use tsx (60.7%), Zod (72.0%), Model Context Protocol SDK (JavaScript) (49.5%).
- It is more common in projects set up for OpenClaw (13.2%) than for Cursor (1.0%).
By coding agent
Often used with
More about chokidar
Funding
- GitHub Sponsors: https://github.com/paulmillr
- GitHub Sponsors: https://github.com/43081j
- Own page: https://paulmillr.com/funding/
- 27 GitHub sponsors
More in Dev workflow and config
Alternatives
chokidar This page
Pick @parcel/watcher when you want a native file watcher that can also tell you what changed while your program was not running.
Pick nodemon when you only want to restart your Node.js app on file changes, without writing any watching code.
Pick watchfiles when your project is written in Python rather than Node.js.
Get started
Tell your AI assistant
“Use the npm package chokidar (pin chokidar@6.0.0, Node.js 22.22+, ES modules) to watch src: ignoreInitial true, ignore dotfiles and node_modules with a regex (no globs), and rerun the build on change; close the watcher on exit.”
Add chokidar to your Node.js project (version 6 needs Node.js 22.22 or newer).
npm install chokidarWatch a folder and print every event.
import chokidar from 'chokidar'; // or: import { watch } from 'chokidar'; // or: const chokidar = require('chokidar'); chokidar.watch('src').on('all', (event, path) => console.log(event, path));Close the watcher when you are done; to watch again, create a new one.
await watcher.close(); // async and terminal: create a new watcher to resume
Mistakes to avoid
Globs were removed in version 4; a pattern string is now treated as a plain path.
A string in ignored is an exact path, not a pattern; regular expressions test the whole path.
The old option names are deprecated aliases in version 6.
close() is final; once closing has started, add() throws.
Each major version raised the minimum Node.js version.
Questions
Can I watch "src/**/*.ts" like in old examples?
Not since version 4. Watch the folder and filter with a function, or expand the pattern yourself and pass the file list.
Why do I get events for files that already exist when I start?
The first scan reports every existing file as added. Set ignoreInitial to true to skip those events.
My process never exits while watching. Is that a bug?
No. A watcher keeps the process alive by default; set persistent to false or call close().
Can I reuse a watcher after closing it?
No. Closing is final; create a new watcher to start again.