This package has been deprecated

Author message:

This project has been renamed. Install using filesnitch instead.

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

1.0.0 • Public • Published

Astrowatch - 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 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 }));

Copyright & contributors

Copyright © 2023 Astrohelm contributors. Astrowatch is MIT licensed.
Astrowatch is part of Astrohelm ecosystem.

Package Sidebar

Install

npm i astrowatch

Homepage

astrohelm.ru

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

8.13 kB

Total Files

7

Last publish

Collaborators

  • sashapop10