Need CDN for javascript libraries for small embedded device

I am designing a small device that has limited on board storage, but requires some 6-10 Mb of JavaScript libraries to run. There may be a few dozen of these devices scattered at various locations (so not just one web site). The amount of data transmitted will be limited (likely a few Gb/month max - as a download is only required when performing certain graphing functions). Is there a good low cost way to setup an account such as this.


Cloudflare R2 has a free tier that includes 10GB of storage & 10,000,000 Class B operations per month.

Downloading files would count as a Class B operation.

Currently having files publicly available from R2 requires being served through Workers which has a free tier of 100,000 requests a day. R2’s public buckets functionality is on the roadmap for the coming months.

If that works for you, that’s the easiest & is completely free.


Thanks - I am trying the R2 method, as I think it is likely the easiest to implement

I created the account, I uploaded some files into the account, and they appear in a directory I called javascript.They have the correct Type and size on the list.

I tried to access the files on my web application using (I changed the numeric code for the public forum)

The web page however does not load - the error being it does not find certain widgets (that are part of these files).

The page loaded correctly when I linked directly to the widget publisher’s web site

Am I missing a step?


1 Like

How are you accessing the files from R2?

They’re currently only public when using a Worker to make them public - do you have an example of your Worker’s code?

Is there an easy way to do this - to just expose the files as is for download via script type source in my web page headers . I did not setup any Workers, but not sure how they would be implemented to accomplish the goal.


I saw this online

Public buckets, so a bucket can be exposed to the internet without writing a Worker

But I guess that is only a future option?

I expect it to be an option within the next 1-2 months.

GitHub - kotx/render: Cloudflare Worker to proxy and cache requests to R2 is a good Worker that you can use to serve R2 files publicly.

I think I will wait for the option - in the interim I will just like to the vendor’s web site (a little slow). Will you be sending out emails when the option is available?


That’s up to the R2 team but there’s a public changelog available at which is kept up-to-date pretty quickly so you can check back in on that.

If you use Discord, the R2 team are pretty active & post releases in Cloudflare Developers

Thanks - joined, and will watch periodically