diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-02-21 13:21:51 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-21 13:21:51 -0500 |
commit | bd640bc7e6a946dec4477afc64d8083e372660f6 (patch) | |
tree | cb08b999ad594dc0796fa1fefc588c0b86083066 /std/manual.md | |
parent | 754b8c65ad5adda2961c667a6b64ab59c130111d (diff) |
feat: Deno.fsEvents() (#3452)
Diffstat (limited to 'std/manual.md')
-rw-r--r-- | std/manual.md | 17 |
1 files changed, 17 insertions, 0 deletions
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 |