Read R2 data using Workers

I tried copying this script to Workers

https://developers.cloudflare.com/r2/examples/demo-worker/

I am getting error on Line 1

Uncaught SyntaxError: Unexpected strict mode reserved word at line 1 (Code: 10021)

This is a TypeScript example so you will need to use it with wrangler - sounds like you’re using it in Quick Edit which only accepts JavaScript.

Found it.

Here is Cloudflare R2 Script to Public Bucket

1 Like