How to programmatically download all objects from a R2 bucket?

We’d like to run a script and download all objects of a R2 bucket.

Probably we can use S3 compatible api ListObjectsV2 to list and paginate through all objects.

But wanted to check if there’s a more Cloudflare-native way to do so…

I’ve checked wrangler2 and Cloudflare API. No luck so far…

The S3 API is going to be the easiest. Cloudflare’s API does not support any object interaction because that is what the S3 API is for. Wrangler only lets you download a single object and doesn’t support listing objects.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.