summaryrefslogtreecommitdiff
path: root/std/examples/curl.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/examples/curl.ts')
-rw-r--r--std/examples/curl.ts8
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);