chokidar uses picomatch library to create regex from glob strings.
it is written in picomatch documentation that brackets should be escaped with double backslashes
Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms.
To match any of the following characters as literals: `$^*+?()[]
Examples:
console.log(pm.makeRe('foo/bar \\(1\\)'));
console.log(pm.makeRe('foo/bar \\(1\\)'));
Why the code below does not trigger any events?
It should match e.g: C:/Program Files (x86)/Folder/random name/dist/file.txt
const chokidar = require('chokidar');
const watcher = chokidar.watch('C:/Program Files \\(x86\\)/Folder/**/dist/*.txt')
watcher
.on('add', path => console.log(`File ${path} has been added`))
.on('change', path => console.log(`File ${path} has been changed`))
.on('unlink', path => console.log(`File ${path} has been removed`))
.on('addDir', path => console.log(`Directory ${path} has been added`))
.on('unlinkDir', path => console.log(`Directory ${path} has been removed`))
.on('error', error => console.log(`Watcher error: ${error}`))
.on('ready', () => console.log('Initial scan complete. Ready for changes'))