@miniflare/watcher
v2.14.4
Published
File-system watcher module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers
Downloads
440,358
Maintainers
Readme
@miniflare/watcher
File-system watcher module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers.
Example
import { Watcher } from "@miniflare/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();