diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/examples/tcp_echo.md | 8 | ||||
-rw-r--r-- | docs/examples/unix_cat.md | 7 | ||||
-rw-r--r-- | docs/getting_started/first_steps.md | 6 |
3 files changed, 13 insertions, 8 deletions
diff --git a/docs/examples/tcp_echo.md b/docs/examples/tcp_echo.md index a66fe05ed..f016b8bd8 100644 --- a/docs/examples/tcp_echo.md +++ b/docs/examples/tcp_echo.md @@ -4,8 +4,9 @@ - Listening for TCP port connections with [Deno.listen](https://doc.deno.land/builtin/stable#Deno.listen). -- Use [Deno.copy](https://doc.deno.land/builtin/stable#Deno.copy) to take - inbound data and redirect it to be outbound data. +- Use + [copy](https://doc.deno.land/https/deno.land/std@$STD_VERSION/io/util.ts#copy) + to take inbound data and redirect it to be outbound data. ## Example @@ -16,10 +17,11 @@ returns to the client anything it sends. /** * echo_server.ts */ +import { copy } from "https://deno.land/std@$STD_VERSION/io/util.ts"; const listener = Deno.listen({ port: 8080 }); console.log("listening on 0.0.0.0:8080"); for await (const conn of listener) { - Deno.copy(conn, conn).finally(() => conn.close()); + copy(conn, conn).finally(() => conn.close()); } ``` diff --git a/docs/examples/unix_cat.md b/docs/examples/unix_cat.md index fc09d4e27..0ce28d718 100644 --- a/docs/examples/unix_cat.md +++ b/docs/examples/unix_cat.md @@ -7,8 +7,8 @@ command line arguments. - [Deno.open](https://doc.deno.land/builtin/stable#Deno.open) is used to get a handle to a file. -- [Deno.copy](https://doc.deno.land/builtin/stable#Deno.copy) is used to - transfer data from the file to the output stream. +- [copy](https://doc.deno.land/https/deno.land/std@$STD_VERSION/io/util.ts#copy) + is used to transfer data from the file to the output stream. - Files should be closed when you are finished with them - Modules can be run directly from remote URLs. @@ -21,9 +21,10 @@ is opened, and printed to stdout (e.g. the console). /** * cat.ts */ +import { copy } from "https://deno.land/std@$STD_VERSION/io/util.ts"; for (const filename of Deno.args) { const file = await Deno.open(filename); - await Deno.copy(file, Deno.stdout); + await copy(file, Deno.stdout); file.close(); } ``` diff --git a/docs/getting_started/first_steps.md b/docs/getting_started/first_steps.md index 9a0fdab7c..fda5bc47b 100644 --- a/docs/getting_started/first_steps.md +++ b/docs/getting_started/first_steps.md @@ -86,10 +86,11 @@ In this program each command-line argument is assumed to be a filename, the file is opened, and printed to stdout. ```ts +import { copy } from "https://deno.land/std@$STD_VERSION/io/util.ts"; const filenames = Deno.args; for (const filename of filenames) { const file = await Deno.open(filename); - await Deno.copy(file, Deno.stdout); + await copy(file, Deno.stdout); file.close(); } ``` @@ -111,12 +112,13 @@ This is an example of a server which accepts connections on port 8080, and returns to the client anything it sends. ```ts +import { copy } from "https://deno.land/std@$STD_VERSION/io/util.ts"; const hostname = "0.0.0.0"; const port = 8080; const listener = Deno.listen({ hostname, port }); console.log(`Listening on ${hostname}:${port}`); for await (const conn of listener) { - Deno.copy(conn, conn); + copy(conn, conn); } ``` |