Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
This package has been deprecated with the following message: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
Generated on May 4, 2024 via pnpm

chokidar 2.0.4

A neat wrapper around node.js fs.watch / fs.watchFile / fsevents.
Package summary
Share
8
issues
8
high severity
vulnerability
1
meta
7
4
licenses
102
MIT
5
ISC
1
(MIT OR Apache-2.0)
1
BSD-3-Clause
Package created
26 Apr 2012
Version published
18 Jun 2018
Maintainers
2
Total deps
109
Direct deps
13
License
MIT

Issues

8

8 high severity issues

high
Recommendation: Upgrade to version 5.1.2 or later
via: glob-parent@3.1.0
via: chokidar@2.0.4
via: fsevents@1.2.13
via: fsevents@1.2.13
via: anymatch@2.0.0 & others
via: anymatch@2.0.0 & others
via: anymatch@2.0.0 & others
via: anymatch@2.0.0 & others
Collapse
Expand

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
102 Packages, Including:
arr-diff@4.0.0
arr-flatten@1.1.0
arr-union@3.1.0
array-unique@0.3.2
assign-symbols@1.0.0
async-each@1.0.6
base@0.11.2
binary-extensions@1.13.1
bindings@1.5.0
braces@2.3.2
cache-base@1.0.1
chokidar@2.0.4
class-utils@0.3.6
collection-visit@1.0.0
component-emitter@1.3.1
copy-descriptor@0.1.1
core-util-is@1.0.3
debug@2.6.9
decode-uri-component@0.2.2
define-property@0.2.5
define-property@1.0.0
define-property@2.0.2
expand-brackets@2.1.4
extend-shallow@2.0.1
extend-shallow@3.0.2
extglob@2.0.4
file-uri-to-path@1.0.0
fill-range@4.0.0
for-in@1.0.2
fragment-cache@0.2.1
fsevents@1.2.13
function-bind@1.1.2
get-value@2.0.6
has-value@0.3.1
has-value@1.0.0
has-values@0.1.4
has-values@1.0.0
hasown@2.0.2
is-accessor-descriptor@1.0.1
is-binary-path@1.0.1
is-buffer@1.1.6
is-data-descriptor@1.0.1
is-descriptor@0.1.7
is-descriptor@1.0.3
is-extendable@0.1.1
is-extendable@1.0.1
is-extglob@2.1.1
is-glob@3.1.0
is-glob@4.0.3
is-number@3.0.0

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
5 Packages, Including:
anymatch@2.0.0
glob-parent@3.1.0
graceful-fs@4.2.11
inherits@2.0.4
remove-trailing-separator@1.1.0

(MIT OR Apache-2.0)

Permissive
1 Packages, Including:
atob@2.1.2

BSD 3-Clause "New" or "Revised" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
use-trademark
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
source-map@0.5.7
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

13
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
anymatch2.0.03.36 kBISC
prod
4
async-each1.0.62.11 kBMIT
prod
braces2.3.217.12 kBMIT
prod
4
fsevents1.2.137.67 kBMIT
prod optional
2
glob-parent3.1.02.78 kBISC
prod
1
inherits2.0.41.98 kBISC
prod
is-binary-path1.0.11.52 kBMIT
prod
is-glob4.0.34.16 kBMIT
prod
lodash.debounce4.0.85.09 kBMIT
prod
normalize-path2.1.13.08 kBMIT
prod
path-is-absolute1.0.11.84 kBMIT
prod
readdirp2.2.16.99 kBMIT
prod
4
upath1.2.07.8 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.