From 27cd2c97f18c0392bc04c66b786717b2bc677315 Mon Sep 17 00:00:00 2001 From: Rory Hart Date: Tue, 22 Oct 2019 01:36:01 +1100 Subject: curl.ts example with reference in manual (#3161) --- std/examples/curl.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 std/examples/curl.ts (limited to 'std/examples/curl.ts') 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 { + const res = await fetch(url); + await Deno.copy(Deno.stdout, res.body); +} + +await curl(Deno.args[1]); +Deno.exit(0); -- cgit v1.2.3