1.0.0 • Published 9 months ago
astrowatch v1.0.0
npm i leadwatch --save
const DirectoryWatcher = require('astrowatch');
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
home: process.cwd(), // Removes root path from emits, Warning: ignore will work on full paths
});
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('delete', path => console.log({ deleted: path }));
watcher.on('after', updates => console.log({ after: updates }));
1.0.0
9 months ago