I’m using CloudFlare service workers and I want to fetch an image and then generate a base64 representation of it.
So something like this:
const res = await fetch('https://cdn.cnn.com/cnnnext/dam/assets/211010073527-tyson-fury-exlarge-169.jpg') const blob = await res.blob(); console.log(blob) console.log(btoa(blob))
this of course doesn’t work, any ideas how to get this resolved?
Source: JavaSript – Stack OverflowOctober 13, 2021