Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Apr 20, 2024 via pnpm

chokidar 3.5.3

Minimal and efficient cross-platform file watching library
Package summary
Share
0
issues
2
licenses
13
MIT
2
ISC
Package created
26 Apr 2012
Version published
18 Jan 2022
Maintainers
2
Total deps
15
Direct deps
8
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
13 Packages, Including:
binary-extensions@2.3.0
braces@3.0.2
chokidar@3.5.3
fill-range@7.0.1
fsevents@2.3.3
is-binary-path@2.1.0
is-extglob@2.1.1
is-glob@4.0.3
is-number@7.0.0
normalize-path@3.0.0
picomatch@2.3.1
readdirp@3.6.0
to-regex-range@5.0.1

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
anymatch@3.1.3
glob-parent@5.1.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

8
All Dependencies CSV
β“˜ This is a list of chokidar 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
anymatch3.1.33.57 kBISC
prod
braces3.0.215.27 kBMIT
prod
fsevents2.3.322.27 kBMIT
prod optional
glob-parent5.1.24.74 kBISC
prod
is-binary-path2.1.01.58 kBMIT
prod
is-glob4.0.34.16 kBMIT
prod
normalize-path3.0.03.48 kBMIT
prod
readdirp3.6.07.38 kBMIT
prod

Visualizations

Frequently Asked Questions

What does chokidar do?

Chokidar is a highly efficient and minimalistic cross-platform library in Node.js that is designed for file watching. It addresses the common issues associated with Node.js's fs.watch and fs.watchFile, which include not reporting filenames on MacOS, not reporting events when using certain editors on MacOS, often reporting events twice, and not supporting recursive watching among others. By using fs.watch and fs.watchFile for watching and normalizing the events it receives, Chokidar provides a robust solution to these problems. Chokidar is the library of choice for successful implementation in production environments for major software like Microsoft's Visual Studio Code, Gulp, and Webpack.

How do you use chokidar?

To use Chokidar, you need to install it via npm using the command npm install chokidar. Once installed, you can import it into your project using require and start watching files or directories as shown in the following example:

const chokidar = require('chokidar');

// One-liner for the current directory, logs all events
chokidar.watch('.').on('all', (event, path) => {
  console.log(event, path);
});

// More complex example with event listeners
const watcher = chokidar.watch('file, dir, glob, or array', {
  ignored: /(^|[\/\\])\../, // ignore dotfiles
  persistent: true
});

const log = console.log.bind(console);

// Add event listeners
watcher
  .on('add', path => log(`File ${path} has been added`))
  .on('change', path => log(`File ${path} has been changed`))
  .// ...

You can add new files to the watcher, get the list of actual paths being watched, stop watching certain files, and even stop watching completely using watcher.add(), watcher.getWatched(), watcher.unwatch(), and watcher.close() respectively.

Where are the chokidar docs?

The complete documentation and API reference for Chokidar can be found directly in its repository on GitHub at https://github.com/paulmillr/chokidar. It provides a complete guide on how to use Chokidar's methods and options, handle events, use the CLI, as well as troubleshooting tips and more details about its inner workings.