From bd640bc7e6a946dec4477afc64d8083e372660f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 21 Feb 2020 13:21:51 -0500 Subject: feat: Deno.fsEvents() (#3452) --- std/manual.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'std/manual.md') diff --git a/std/manual.md b/std/manual.md index 99feef15b..33e6c1d02 100644 --- a/std/manual.md +++ b/std/manual.md @@ -467,6 +467,23 @@ for await (const _ of sig) { The above for-await loop exits after 5 seconds when sig.dispose() is called. +### File system events + +To poll for file system events: + +```ts +const iter = Deno.fsEvents("/"); +for await (const event of iter) { + 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 + ### Linking to third party code In the above examples, we saw that Deno could execute scripts from URLs. Like -- cgit v1.2.3