diff options
Diffstat (limited to 'docs/examples')
| -rw-r--r-- | docs/examples/file_server.md (renamed from docs/examples/fileserver.md) | 2 | ||||
| -rw-r--r-- | docs/examples/file_system_events.md | 18 | ||||
| -rw-r--r-- | docs/examples/tcp_echo.md | 2 | ||||
| -rw-r--r-- | docs/examples/unix_cat.md | 2 |
4 files changed, 21 insertions, 3 deletions
diff --git a/docs/examples/fileserver.md b/docs/examples/file_server.md index 3ed9d90e7..9fbe27bd3 100644 --- a/docs/examples/fileserver.md +++ b/docs/examples/file_server.md @@ -2,7 +2,7 @@ This one serves a local directory in HTTP. -```bash +```shell deno install --allow-net --allow-read https://deno.land/std/http/file_server.ts ``` 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 diff --git a/docs/examples/tcp_echo.md b/docs/examples/tcp_echo.md index d7c2e9e72..360c5facc 100644 --- a/docs/examples/tcp_echo.md +++ b/docs/examples/tcp_echo.md @@ -25,7 +25,7 @@ For security reasons, Deno does not allow programs to access the network without explicit permission. To allow accessing the network, use a command-line flag: ```shell -$ deno run --allow-net https://deno.land/std/examples/echo_server.ts +deno run --allow-net https://deno.land/std/examples/echo_server.ts ``` To test it, try sending data to it with netcat: diff --git a/docs/examples/unix_cat.md b/docs/examples/unix_cat.md index 7534ef0d0..ca85ea325 100644 --- a/docs/examples/unix_cat.md +++ b/docs/examples/unix_cat.md @@ -20,5 +20,5 @@ I/O streams in Deno. Try the program: ```shell -$ deno run --allow-read https://deno.land/std/examples/cat.ts /etc/passwd +deno run --allow-read https://deno.land/std/examples/cat.ts /etc/passwd ``` |
