Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

chokidar

React when files change in Node.js.

Dev workflow and configNPM

GitHubWebsite

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/LICENSE

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

74 / 100
Gid Score, #221 overall
293M
downloads a week, npm
12.3K
GitHub stars
107
agent projects use it
chokidar: downloads per weeknpm, chokidar 292,666,295
chokidar: GitHub starspaulmillr/chokidar 12,275

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

87 projects, 2.7%
45 projects, 1.5%
44 projects, 13.2%
27 projects, 5.7%
25 projects, 1.0%
11 projects, 2.3%

Often used with

In 60.7% of its projects
In 72.0% of its projects
In 49.5% of its projects
In 49.5% of its projects
In 47.7% of its projects
In 44.9% of its projects
In 57.9% of its projects

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

See all

More in Dev workflow and config

Alternatives

chokidar This page

MITGid 74293M/wk

@parcel/watcher

Pick @parcel/watcher when you want a native file watcher that can also tell you what changed while your program was not running.

nodemon

Pick nodemon when you only want to restart your Node.js app on file changes, without writing any watching code.

MITGid 7617M/wk

watchfiles

Pick watchfiles when your project is written in Python rather than Node.js.

Compare chokidar with another tool

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.”

  1. Add chokidar to your Node.js project (version 6 needs Node.js 22.22 or newer).

    npm install chokidar

    From github.com/paulmillr/chokidar/blob/main/README.md

  2. Watch 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));
    

    From github.com/paulmillr/chokidar/blob/main/README.md

  3. 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

    From github.com/paulmillr/chokidar/blob/main/README.md

Mistakes to avoid

chokidar.watch('**/*.js')
chokidar.watch('.', { ignored: (path, stats) => stats?.isFile() && !path.endsWith('.js') })

Globs were removed in version 4; a pattern string is now treated as a plain path.

ignored: 'node_modules/**'
ignored: /\/node_modules\//

A string in ignored is an exact path, not a pattern; regular expressions test the whole path.

chokidar.watch(dir, { usePolling: true, interval: 500 })
chokidar.watch(dir, { backend: 'polling', pollingInterval: 500 })

The old option names are deprecated aliases in version 6.

await watcher.close(); watcher.add('src')
Create a new watcher with chokidar.watch('src') after closing

close() is final; once closing has started, add() throws.

Installing chokidar 6 in a project that runs on Node.js 20
Upgrade to Node.js 22.22+, or pin chokidar@5 for Node.js 20

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.