Gathering detailed insights and metrics for glob-watcher
Gathering detailed insights and metrics for glob-watcher
Gathering detailed insights and metrics for glob-watcher
Gathering detailed insights and metrics for glob-watcher
Watch globs and execute a function upon change, with intelligent defaults for debouncing and queueing.
npm install glob-watcher
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
80 Stars
71 Commits
59 Forks
9 Watchers
2 Branches
12 Contributors
Updated on Aug 06, 2024
Latest Version
6.0.0
Package Id
glob-watcher@6.0.0
Unpacked Size
9.66 kB
Size
4.09 kB
File Count
6
NPM Version
9.5.1
Node Version
18.16.0
Published on
May 31, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
Watch globs and execute a function upon change, with intelligent defaults for debouncing and queueing.
1var watch = require('glob-watcher'); 2 3watch(['./*.js', '!./something.js'], function (done) { 4 // This function will be called each time a globbed file is changed 5 // but is debounced with a 200ms delay (default) and queues subsequent calls 6 7 // Make sure to signal async completion with the callback 8 // or by returning a stream, promise, observable or child process 9 done(); 10 11 // if you need access to the `path` or `stat` object, listen 12 // for the `change` event (see below) 13 14 // if you need to listen to specific events, use the returned 15 // watcher instance (see below) 16}); 17 18// Raw chokidar instance 19var watcher = watch(['./*.js', '!./something.js']); 20 21// Listen for the 'change' event to get `path`/`stat` 22// No async completion available because this is the raw chokidar instance 23watcher.on('change', function (path, stat) { 24 // `path` is the path of the changed file 25 // `stat` is an `fs.Stat` object (not always available) 26}); 27 28// Listen for other events 29// No async completion available because this is the raw chokidar instance 30watcher.on('add', function (path, stat) { 31 // `path` is the path of the changed file 32 // `stat` is an `fs.Stat` object (not always available) 33});
watch(globs[, options][, fn])
Takes a path string, an array of path strings, a glob string or an array of glob strings as globs
to watch on the filesystem. Also optionally takes options
to configure the watcher and a fn
to execute when a file changes.
Note: As of 5.0.0, globs must use /
as the separator character because \\
is reserved for escape sequences (as per the Bash 4.3 & Micromatch specs). This means you can't use path.join()
or **dirname
in Windows environments. If you need to usepath.join()
, you can use normalize-path against your paths afterwards. If you need to use **dirname
, you can set it as the cwd
option that gets passed directly to chokidar. The micromatch docs contain more information about backslashes.
Returns an instance of chokidar.
fn([callback])
If the fn
is passed, it will be called when the watcher emits a change
, add
or unlink
event. It is automatically debounced with a default delay of 200 milliseconds and subsequent calls will be queued and called upon completion. These defaults can be changed using the options
.
The fn
is passed a single argument, callback
, which is a function that must be called when work in the fn
is complete. Instead of calling the callback
function, async completion can be signalled by:
Stream
or EventEmitter
Child Process
Promise
Observable
Once async completion is signalled, if another run is queued, it will be executed.
options
options.ignoreInitial
If set to false
the fn
is called during chokidar instantiation as it discovers the file paths. Useful if it is desirable to trigger the fn
during startup.
Passed through to chokidar, but defaulted to true
instead of false
.
Type: Boolean
Default: true
options.delay
The delay to wait before triggering the fn
. Useful for waiting on many changes before doing the work on changed files, e.g. find-and-replace on many files.
Type: Number
Default: 200
(milliseconds)
options.queue
Whether or not a file change should queue the fn
execution if the fn
is already running. Useful for a long running fn
.
Type: Boolean
Default: true
options.events
An event name or array of event names to listen for. Useful if you only need to watch specific events.
Type: String | Array<String>
Default: [ 'add', 'change', 'unlink' ]
Options are passed directly to chokidar.
MIT
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 2/29 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More