cloudflare-worker-router
cloudflare-worker-router copied to clipboard
Images?
Hello, I use workers as an image cdn and i'm trying to turn it from multiple workers into one with routing, but i can't seem to be able to send image data with this.
I'd appreciate any help, cheers.
Hey, sorry for my late reply. I'm going to test this and fix it if necessary.
Hi Kieran & Tsndr
This is already possible, you just need to use the raw attribute on the response res object.
router.get('/image/:x', async (req, res) => {
const response = await fetch('https://xxx.com/images/'+x)
res.raw = response
})
Sorry, haven't had time to get to it yet, but I will look into it for sure :)