mirror of
https://github.com/denoland/deno
synced 2024-10-13 11:32:29 +00:00
11 lines
389 B
TypeScript
11 lines
389 B
TypeScript
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
const url_ = Deno.args[0];
|
|
const res = await fetch(url_);
|
|
|
|
// TODO(ry) Re-enable streaming in this example.
|
|
// Originally we did: await Deno.copy(res.body, Deno.stdout);
|
|
// But maybe more JS-y would be: res.pipeTo(Deno.stdout);
|
|
|
|
const body = new Uint8Array(await res.arrayBuffer());
|
|
await Deno.stdout.write(body);
|