How to GET a binary file and POST it somewhere else?

I’d like to use a worker to upload images to the new CF Images service.
The basic upload procedure includes saving the file locally and submit it as a Form POST.

curl -X POST "" \
     -H "X-Auth-Email: [email protected]" \
     -H "X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41" \
     --form '[email protected]/Users/kyle/Desktop/logo.png' 

I believe workers don’t have access to local storage, so I’m puzzled on how to save and submit the binary file contents between the GET and the POST.
Save it temporarily in a KV variable?
Encode it and keep it in memory?
Thanks for any suggestion

You can upload the file to Workers, I have a blog post on this - Handling File Uploads with Cloudflare Workers

Then you can just upload to Images from there


Yes, to add, the direct docs:

1 Like