summaryrefslogtreecommitdiff
path: root/docs/examples/file_system_events.md
diff options
context:
space:
mode:
authorLuca Casonato <lucacasonato@yahoo.com>2020-05-10 03:09:42 +0200
committerGitHub <noreply@github.com>2020-05-10 03:09:42 +0200
commit45f9b32ef0416e0477e9f5335df49ca3cccdb6eb (patch)
treeb04cab2d36b39932320f9e95537910b8742f32f7 /docs/examples/file_system_events.md
parentf6b617784f53497b0c59d6f6f1370cb2223e38f3 (diff)
Docs for deno test + minor other changes (#5185)
* Added fs events example. * Added docs for `deno test`. * Renamed file server example. * Unified markdown code types. * Removed plugin topics from TOC. * Fixed links.
Diffstat (limited to 'docs/examples/file_system_events.md')
-rw-r--r--docs/examples/file_system_events.md18
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/examples/file_system_events.md b/docs/examples/file_system_events.md
new file mode 100644
index 000000000..2abebc33e
--- /dev/null
+++ b/docs/examples/file_system_events.md
@@ -0,0 +1,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