Is it possible to upload files via the API?
I would like to deploy a site (let's say consisting of an index.html and a style.css file) to cloudflare pages. Is it possible to do this via the API? I couldn't find anything in the docs. Thanks!
2 Replies
There is no official api for file uploads. Wrangler pages publish is the correct way to upload a directory of files. You could reverse wrangler and make your own script but it’s easier to use wrangler
thanks @cyb3rjak3! that's what I was afraid of. Unfortunately, I'm trying to get this to work in Deno so wrangler is not an option.
just for reference – this is where the magic happens in wrangler, I think: https://github.com/cloudflare/workers-sdk/blob/main/packages/wrangler/src/pages/upload.tsx
GitHub
workers-sdk/packages/wrangler/src/pages/upload.tsx at main · cloudf...
⛅️ Home to Wrangler, the CLI for Cloudflare Workers® - cloudflare/workers-sdk