DenoDDeno
Powered by
Captain π—•π—˜π—˜π—™πŸ₯©C
Denoβ€’3y agoβ€’
1 reply
Captain π—•π—˜π—˜π—™πŸ₯©

Why am I getting an "Uncaught DOM Exception" in the Deno CLI?

To replicate:
1.
deno
deno
in the command line to initialize a Deno REPL
// Get an array of random bytes
const arr = new Uint8Array(32)
crypto.getRandomValues(arr)

const decoder = new TextDecoder("utf8")
btoa(decoder.decode(arr));
> Uncaught DOMException
// Get an array of random bytes
const arr = new Uint8Array(32)
crypto.getRandomValues(arr)

const decoder = new TextDecoder("utf8")
btoa(decoder.decode(arr));
> Uncaught DOMException


The goal was to get a base64 encoding of the byte array. What am I doing wrong?
atob
atob
produces the same result.
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Deno Deploy failed:Uncaught Exception /Permission Denied : Deno.exit() is not allowed
JMvelascoJJMvelasco / help
3y ago
Looking for an alternative to deno_dom
babakfpBbabakfp / help
3y ago
Deno CLI Broken
bbqchickenrobotBbbqchickenrobot / help
2y ago
Trouble accessing Deno KV via the Deno CLI
NicoNNico / help
3y ago