summaryrefslogtreecommitdiff
path: root/docs/examples/file_system_events.md
blob: 2999ccdfe1603c5cfb16622f26a2f89b96741d6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
## File system events

To poll for file system events:

```ts
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