diff options
author | Luca Casonato <hello@lcas.dev> | 2021-07-12 19:44:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-12 19:44:42 +0200 |
commit | 51e0bfda3c5df4fa1f1b36301193038ed6aaf7bf (patch) | |
tree | f730a56750444a94fdb42e508326d61754d24e07 /docs/getting_started | |
parent | 00484d24ba93418bbdde8e42483d56e3714efaa0 (diff) |
chore(runtime): deprecate `Deno.copy` (#11369)
Diffstat (limited to 'docs/getting_started')
-rw-r--r-- | docs/getting_started/first_steps.md | 6 |
1 files changed, 4 insertions, 2 deletions
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); } ``` |