1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-25 00:29:09 -05:00
denoland-deno/docs/examples/file_system_events.md
2020-08-17 12:17:57 -04:00

436 B

File system events

To poll for file system events:

const watcher = Deno.watchFs("/");
for await (const event of watcher) {
  console.log(">>>> event", event);
  // { kind: "create", paths: [ "/foo.txt" ] }
}

Note that the exact ordering of the events can vary between operating systems. This feature uses different syscalls depending on the platform:

  • Linux: inotify
  • macOS: FSEvents
  • Windows: ReadDirectoryChangesW