Skip to content

Instantly share code, notes, and snippets.

@braden-w
Created January 13, 2021 20:01
Show Gist options
  • Save braden-w/0f816cd462339469ef9a06b634d5580c to your computer and use it in GitHub Desktop.
Save braden-w/0f816cd462339469ef9a06b634d5580c to your computer and use it in GitHub Desktop.
Implement fetch() in Deno. Taken from Deno Docs, Getting Started.
/*
Run the following in command line:
deno run --allow-net testDeno.ts https://www.wikipedia.org/
From: https://deno.land/manual@v1.6.3/getting_started/first_steps
*/
const url = Deno.args[0]
const res = await fetch(url)
const body = new Uint8Array(await res.arrayBuffer())
await Deno.stdout.write(body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment