{
 "kind": "tool",
 "slug": "chokidar",
 "path": "tools/chokidar/",
 "name": "chokidar",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Dev workflow and config",
   "tools/dev-workflow/"
  ]
 ],
 "lead": "React when files change in Node.js.",
 "chips": [
  {
   "label": "Dev workflow and config",
   "path": "tools/dev-workflow/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install chokidar"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/paulmillr/chokidar"
  },
  {
   "label": "Website",
   "href": "https://github.com/paulmillr/chokidar"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software",
   "note": "MIT allows use in paid and closed-source products.",
   "src": "https://github.com/paulmillr/chokidar/blob/main/LICENSE"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 6, 2026",
   "note": "Latest GitHub release Oct 19, 2026. ",
   "src": "https://github.com/paulmillr/chokidar"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "107 projects",
   "status": "info",
   "sub": "#18 of 299 in its category",
   "note": "Dependency in 107 public GitHub projects set up for AI coding agents that we scanned (1.7%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Install only",
   "status": "info",
   "sub": null,
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 11, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What chokidar does",
   "parts": [
    {
     "t": "prose",
     "text": "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."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Rebuild when source files change",
       "text": "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.",
       "idea": false
      },
      {
       "title": "Process files dropped into a folder",
       "text": "Customers or a scanner drop files into an inbox folder; your app picks each one up only after it has finished copying.",
       "idea": false
      },
      {
       "title": "Watch a network or shared drive",
       "text": "Files live on a network share or an unusual drive where normal change alerts are unreliable; chokidar can check them on a timer instead.",
       "idea": false
      },
      {
       "title": "Survive editors that save in two steps",
       "text": "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.",
       "idea": false
      },
      {
       "title": "Keep an AI agent's file index fresh",
       "text": "Your coding agent keeps a search index of a project; when a file changes, only that file is read and indexed again.",
       "idea": true
      },
      {
       "title": "Reload a docs preview on save",
       "text": "A small preview server for Markdown docs refreshes the browser page whenever a writer saves a page.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "chokidar popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "74",
       "of": "/ 100",
       "l": "Gid Score, #221 overall"
      },
      {
       "n": "293M",
       "l": "downloads a week, npm"
      },
      {
       "n": "12.3K",
       "l": "GitHub stars"
      },
      {
       "n": "107",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How chokidar is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "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%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "87 projects, 2.7%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "45 projects, 1.5%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "44 projects, 13.2%",
       "v": "OpenClaw",
       "path": "agents/openclaw/"
      },
      {
       "l": "27 projects, 5.7%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "25 projects, 1.0%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "11 projects, 2.3%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 60.7% of its projects",
       "v": "tsx",
       "path": "tools/tsx/"
      },
      {
       "l": "In 72.0% of its projects",
       "v": "Zod",
       "path": "tools/zod/"
      },
      {
       "l": "In 49.5% of its projects",
       "v": "Model Context Protocol SDK (JavaScript)",
       "path": "tools/modelcontextprotocol/"
      },
      {
       "l": "In 49.5% of its projects",
       "v": "chalk",
       "path": "tools/chalk/"
      },
      {
       "l": "In 49.5% of its projects",
       "v": "ws",
       "path": "tools/ws/"
      },
      {
       "l": "In 47.7% of its projects",
       "v": "yaml",
       "path": "tools/yaml/"
      },
      {
       "l": "In 44.9% of its projects",
       "v": "Express",
       "path": "tools/express/"
      },
      {
       "l": "In 57.9% of its projects",
       "v": "Vitest",
       "path": "tools/vitest/"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "usage",
   "h2": "More about chokidar",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "GitHub Sponsors: https://github.com/paulmillr",
        "GitHub Sponsors: https://github.com/43081j",
        "Own page: https://paulmillr.com/funding/",
        "27 GitHub sponsors"
       ]
      },
      {
       "title": "More in Dev workflow and config",
       "path": "tools/dev-workflow/",
       "items": [
        {
         "text": "dotenv",
         "path": "tools/dotenv/"
        },
        {
         "text": "Husky",
         "path": "tools/husky/"
        },
        {
         "text": "python-dotenv",
         "path": "tools/python-dotenv/"
        },
        {
         "text": "lint-staged",
         "path": "tools/lint-staged/"
        },
        {
         "text": "concurrently",
         "path": "tools/concurrently/"
        },
        {
         "text": "Rich",
         "path": "tools/rich/"
        },
        {
         "text": "Pydantic Settings",
         "path": "tools/pydantic-settings/"
        },
        {
         "text": "cross-env",
         "path": "tools/cross-env/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "chokidar",
       "me": true,
       "facts": [
        "MIT",
        "Gid 74",
        "293M/wk"
       ]
      },
      {
       "name": "@parcel/watcher",
       "why": "Pick @parcel/watcher when you want a native file watcher that can also tell you what changed while your program was not running.",
       "path": "tools/parcel-watcher/",
       "facts": []
      },
      {
       "name": "nodemon",
       "why": "Pick nodemon when you only want to restart your Node.js app on file changes, without writing any watching code.",
       "path": "tools/nodemon/",
       "facts": [
        "MIT",
        "Gid 76",
        "17M/wk"
       ]
      },
      {
       "name": "watchfiles",
       "why": "Pick watchfiles when your project is written in Python rather than Node.js.",
       "path": "tools/watchfiles/",
       "facts": []
      }
     ],
     "more": "Compare chokidar with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "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."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Add chokidar to your Node.js project (version 6 needs Node.js 22.22 or newer).",
       "code": "npm install chokidar",
       "src": "https://github.com/paulmillr/chokidar/blob/main/README.md"
      },
      {
       "text": "Watch a folder and print every event.",
       "code": "import chokidar from 'chokidar';\n// or: import { watch } from 'chokidar';\n// or: const chokidar = require('chokidar');\n\nchokidar.watch('src').on('all', (event, path) => console.log(event, path));\n",
       "src": "https://github.com/paulmillr/chokidar/blob/main/README.md"
      },
      {
       "text": "Close the watcher when you are done; to watch again, create a new one.",
       "code": "await watcher.close(); // async and terminal: create a new watcher to resume",
       "src": "https://github.com/paulmillr/chokidar/blob/main/README.md"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "chokidar.watch('**/*.js')",
       "fix": "chokidar.watch('.', { ignored: (path, stats) => stats?.isFile() && !path.endsWith('.js') })",
       "why": "Globs were removed in version 4; a pattern string is now treated as a plain path."
      },
      {
       "dont": "ignored: 'node_modules/**'",
       "fix": "ignored: /\\/node_modules\\//",
       "why": "A string in ignored is an exact path, not a pattern; regular expressions test the whole path."
      },
      {
       "dont": "chokidar.watch(dir, { usePolling: true, interval: 500 })",
       "fix": "chokidar.watch(dir, { backend: 'polling', pollingInterval: 500 })",
       "why": "The old option names are deprecated aliases in version 6."
      },
      {
       "dont": "await watcher.close(); watcher.add('src')",
       "fix": "Create a new watcher with chokidar.watch('src') after closing",
       "why": "close() is final; once closing has started, add() throws."
      },
      {
       "dont": "Installing chokidar 6 in a project that runs on Node.js 20",
       "fix": "Upgrade to Node.js 22.22+, or pin chokidar@5 for Node.js 20",
       "why": "Each major version raised the minimum Node.js version."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Can I watch \"src/**/*.ts\" like in old examples?",
       "a": "Not since version 4. Watch the folder and filter with a function, or expand the pattern yourself and pass the file list.",
       "evidence": {
        "url": "https://github.com/paulmillr/chokidar/blob/main/README.md",
        "quote": "Globs were removed in v4. To replicate them:"
       }
      },
      {
       "q": "Why do I get events for files that already exist when I start?",
       "a": "The first scan reports every existing file as added. Set ignoreInitial to true to skip those events.",
       "evidence": {
        "url": "https://github.com/paulmillr/chokidar/blob/main/README.md",
        "quote": "When true, add / addDir are not emitted for paths discovered during the initial scan (before ready)."
       }
      },
      {
       "q": "My process never exits while watching. Is that a bug?",
       "a": "No. A watcher keeps the process alive by default; set persistent to false or call close().",
       "evidence": {
        "url": "https://github.com/paulmillr/chokidar/blob/main/README.md",
        "quote": "Whether the watcher keeps the process alive while it is watching."
       }
      },
      {
       "q": "Can I reuse a watcher after closing it?",
       "a": "No. Closing is final; create a new watcher to start again.",
       "evidence": {
        "url": "https://github.com/paulmillr/chokidar/blob/main/README.md",
        "quote": "An FSWatcher cannot be reopened after .close() starts; construct a new watcher instead."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm chokidar"
  ],
  [
   "Category",
   "Dev workflow and config"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Gid Score",
   "74.4"
  ],
  [
   "Rank in category",
   "#18 of 299"
  ],
  [
   "GitHub",
   "paulmillr/chokidar"
  ],
  [
   "Last change",
   "Nov 6, 2026"
  ]
 ],
 "good": [
  "Version 6 needs Node.js 22.22 or newer, and since version 5 it ships only as an ES module.",
  "Patterns like \"**/*.js\" no longer work since version 4; you filter with a function or a regular expression instead.",
  "It watches everything under the folders you give it, so keep them narrow and leave out big folders like node_modules."
 ],
 "checked_line": "Read by AgentGid from 4 official pages, card checked Nov 11, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/paulmillr.png"
}