mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
curl.ts example with reference in manual (#3161)
This commit is contained in:
parent
4e88ba9a11
commit
27cd2c97f1
3 changed files with 16 additions and 2 deletions
8
std/examples/curl.ts
Normal file
8
std/examples/curl.ts
Normal file
|
@ -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);
|
Loading…
Add table
Add a link
Reference in a new issue