mirror of
https://github.com/denoland/deno.git
synced 2024-11-01 09:24:20 -04:00
45f9b32ef0
* Added fs events example. * Added docs for `deno test`. * Renamed file server example. * Unified markdown code types. * Removed plugin topics from TOC. * Fixed links.
18 lines
437 B
Markdown
18 lines
437 B
Markdown
### 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
|