Skip to content

metarhia/metawatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

897a997 · Aug 30, 2024

History

94 Commits
Aug 30, 2024
Jun 2, 2023
Nov 16, 2022
Sep 27, 2020
Jun 2, 2023
Sep 27, 2020
Jul 10, 2023
Oct 27, 2023
Aug 30, 2024
May 2, 2021
Aug 30, 2024
Aug 30, 2024
Oct 27, 2023
Aug 19, 2024
Apr 24, 2023
Jul 10, 2023
Aug 30, 2024
Aug 30, 2024
Aug 19, 2024
Jul 17, 2021

Repository files navigation

Deep nested directories watch for node.js

ci status snyk npm version npm downloads/month npm downloads license

  • Watch directories recursive
  • Rebuild recursive when new directories found or old directories remove
  • Deduplicate events with debounce

Usage

const metawatch = require('metawatch');

const watcher = new metawatch.DirectoryWatcher({ timeout: 200 });
watcher.watch('/home/marcus/Downloads');
watcher.watch('/home/marcus/Documents');

watcher.on('change', (fileName) => {
  console.log({ changed: fileName });
});

watcher.on('delete', (fileName) => {
  console.log({ deleted: fileName });
});

watcher.on('before', (changes) => {
  console.log({ changes });
});

watcher.on('after', (changes) => {
  console.log({ changes });
});

Contributors

License & Contributors

Copyright (c) 2020-2024 Metarhia contributors. Metawatch is MIT licensed. Metawatch is a part of Metarhia technology stack.