How to upload images to cloudfare images with nodejs?

how to upload images to cloudfare images with nodejs?

and also is it possible to have my own domain for the images intead of imagedelivery.net url?

POST an image using a NodeJS library to the Cloudflare API. This can be done with the Fetch API, Axios, or whatever your preferred Node HTTP library is. The parameters required to upload an image is shown here.

You can setup uploads to your server, and then upload those given files to the Cloudflare API, using your own domain to do so. The Direct Upload URL endpoint does not support custom domains at this time.

I hope this answers the second question https://developers.cloudflare.com/images/cloudflare-images/serve-images#serving-images-from-custom-domains

1 Like

for the first question, can you tell me the nodejs library which is fit for this purpose ? and how mnay requests per month are allowed ?

Image Delivery:
Whatever’s “reasonable” for your account plan. If you plan on running the next Shopify on Cloudflare on a Free plan, they are allowed to ask you to upgrade to a paid plan, however most smaller sites are suitable on the free plan. This goes for bandwidth usage across all sites, regardless of the use of Cloudflare Images.
You won’t be charged any egress costs for the use of Cloudflare Images, however do note that it is $1 per 100,000 images delivered.

Uploads
When using the Cloudflare API, there is a limit of 1,200 requests in a five minute period. There’s no documented note of rate limits to Direct Creator Uploads.

Just use the Fetch API, easy to learn.

ok thanks for the limits , i already know fetch api,but there i no tutorial on how to make post request with fetch api, there is curl command only ,and it is very confusing

Hi! I got stuck with this too. I worked out how to do it with a netlify function but you could easily switch it up for express Trouble with handling files in Netlify Function - #32 by felixthehat - Support - Netlify Support Forums

This topic was automatically closed after 13 days. New replies are no longer allowed.