@d1testflare/watcher
v2.9.0
Published
File-system watcher module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers
Downloads
79
Maintainers
Readme
@d1testflare/watcher
File-system watcher module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers.
Example
import { Watcher } from "@d1testflare/watcher";
const watcher = new Watcher((changedPath) => {
console.log(changedPath); // Absolute path logged on create, change, delete
});
// Add recursive directory watcher
watcher.watch("./dir");
// Add file watchers
watcher.watch(/* any iterable */ ["./file1.txt", "./file2.txt"]);
// Remove watchers
watcher.unwatch("./file1.txt");
// Remove all watchers
watcher.dispose();