There is a Deno.watch api to watch for file system events:
const watcher = Deno.watchFs("/");
for await (const event of watcher) {
console.log(">>>> event", event);
// { kind: "create", paths: [ "/foo.txt" ] }
}
But how to unwatch after Deno.watch called?