I'm using the fetch api to download an image in Deno. On the Response object, i'm calling the arrayBuffer() method, to get the final data of the response:
const response = await fetch('https://www.example.com/someimage.jpg')
const data = await response.arrayBuffer();//This returns an arrayBuffer.
Then i want to write this data into a file, just like you would do in Node:
await Deno.writeFile('./someimage.jpg' ,data)
The image turns out empty. The docs say Deno.writeFile expects a Uint8Array, but i have no clue how to construct this from the arrayBuffer, that is received from the fetch response.
How can this be done?