leadwatch
v1.3.0
Published
[Node js] File system watcher
Maintainers
Readme
npm i leadwatch --saveconst DirectoryWatcher = require('leadwatch');
const watcher = new DirectoryWatcher({
timeout: 200, // Events debouncing for queue
ignore: [new RegExp(/[\D\d]+\.ignore\D*/)], // Ignore files and directories
deep: false, // Include nested directories
});
watcher.watch('/home/sashapop10/Downloads');
watcher.watch('/home/sashapop10/Documents');
watcher.on('before', updates => console.log({ before: updates }));
watcher.on('change', path => console.log({ changed: path }));
watcher.on('after', updates => console.log({ after: updates }));
watcher.on('delete', path => console.log({ deleted: path }));