diff options
Diffstat (limited to 'std/examples/curl.ts')
-rw-r--r-- | std/examples/curl.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/std/examples/curl.ts b/std/examples/curl.ts index 39e917591..44ee66125 100644 --- a/std/examples/curl.ts +++ b/std/examples/curl.ts @@ -1,4 +1,10 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. const url_ = Deno.args[0]; const res = await fetch(url_); -await Deno.copy(Deno.stdout, res.body); + +// TODO(ry) Re-enable streaming in this example. +// Originally we did: await Deno.copy(Deno.stdout, res.body); +// But maybe more JS-y would be: res.pipeTo(Deno.stdout); + +const body = new Uint8Array(await res.arrayBuffer()); +await Deno.stdout.write(body); |