cloudflare-worker-router icon indicating copy to clipboard operation
cloudflare-worker-router copied to clipboard

Images?

Open KieranHolroyd opened this issue 3 years ago • 3 comments

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.

KieranHolroyd avatar Jan 19 '22 14:01 KieranHolroyd

Hey, sorry for my late reply. I'm going to test this and fix it if necessary.

tsndr avatar Mar 23 '22 19:03 tsndr

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
    })

simonblund avatar Apr 22 '22 20:04 simonblund

Sorry, haven't had time to get to it yet, but I will look into it for sure :)

tsndr avatar May 16 '22 16:05 tsndr