filesnitch
TypeScript icon, indicating that this package has built-in type declarations

1.7.0 • Public • Published

FileSnitch - File system watcher

Watch specific files, directories, deeply nested directories
Rebuild recursive when new directories found or old directories remove
Deduplicate events with debounce

Installation

npm i leadwatch --save

Usage

const Snitch = require('filesnitch');
const snitch = new Snitch({
  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
});

snitch.watch('/home/user/Downloads').watch('/home/user/Documents');
snitch.on('before', updates => console.log({ before: updates }));
snitch.on('change', path => console.log({ changed: path }));
snitch.on('unlink', path => console.log({ deleted: path }));
snitch.on('after', updates => console.log({ after: updates }));

Copyright & contributors

Copyright © 2023 Astrohelm contributors. This library MIT licensed.
And it is part of Astrohelm ecosystem.

Package Sidebar

Install

npm i filesnitch

Homepage

astrohelm.ru

Weekly Downloads

4

Version

1.7.0

License

MIT

Unpacked Size

10.5 kB

Total Files

8

Last publish

Collaborators

  • sashapop10