diff options
author | Rory Hart <hartror@gmail.com> | 2019-10-22 01:36:01 +1100 |
---|---|---|
committer | Ry Dahl <ry@tinyclouds.org> | 2019-10-21 10:36:01 -0400 |
commit | 27cd2c97f18c0392bc04c66b786717b2bc677315 (patch) | |
tree | 6aa6a42b696fa2c2592fa639fa6b07c005b2413b /std/examples/curl.ts | |
parent | 4e88ba9a114279b3969d5ccca1cca0f74c8fc1fd (diff) |
curl.ts example with reference in manual (#3161)
Diffstat (limited to 'std/examples/curl.ts')
-rw-r--r-- | std/examples/curl.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/std/examples/curl.ts b/std/examples/curl.ts new file mode 100644 index 000000000..04dd9d601 --- /dev/null +++ b/std/examples/curl.ts @@ -0,0 +1,8 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +async function curl(url: string): Promise<void> { + const res = await fetch(url); + await Deno.copy(Deno.stdout, res.body); +} + +await curl(Deno.args[1]); +Deno.exit(0); |