Skip to content
/ r2 Public

☁️ Command Line Interface for Cloudflare R2 Storage

License

Notifications You must be signed in to change notification settings

erdos-one/r2

R2 CLI

Cloudflare R2 object storage made easy

Purpose

r2 is a library and command line interface for working with Cloudflare's R2 Storage.

Cloudflare's R2 implements the S3 API, attempting to allow users and their applications to migrate easily, but importantly lacks the key, simple-to-use features provided by the AWS CLI's s3 subcommand, as opposed to the more complex and verbose API calls of the s3api subcommand. This CLI fills that gap.

Installation

To install the r2 CLI, simply run the following command:

go install github.com/erdos-one/r2@latest

For more installation options, see INSTALL.md.

Usage

To view the CLI's help message, run:

r2 help

Available Commands

  • r2 configure — Configure R2 access
  • r2 cp — Copy an object from one R2 path to another
  • r2 help — Help about any command
  • r2 ls — List either all buckets or all objects in a bucket
  • r2 mb — Create an R2 bucket
  • r2 mv — Moves a local file or R2 object to another location locally or in R2.
  • r2 presign — Generate a pre-signed URL for a Cloudflare R2 object
  • r2 rb — Remove an R2 bucket
  • r2 rm — Remove an object from an R2 bucket
  • r2 sync — Syncs directories and R2 prefixes.

To view the help message for a specific command, run:

r2 help <command>

For more usage information — including library usage — see USAGE.md.

Progress

We're working to implement all the functionality of the AWS CLI's s3 subcommand. As of v0.1.0-alpha, we have all the commands implemented, but not all the options. We're working on it, but if you'd like to lend a helping hand, we'd much appreciate your help!

To view the latest changes, see CHANGELOG.md.

Contributing

Our expected workflow is: Fork → Patch → Push → Pull Request.

Another helpful way to contribute is to report bugs or request features by opening an issue. We appreciate contributions of all kinds!

To understand the codebase, we recommend reading the ARCHITECTURE.md file.