r2ools
What is this?
A wrapper for the official aws cli tool, with cloudflare r2 in mind
This tool was designed for use by myself only. Support may not be provided for any issues faced.
Err handling by Sentry
Made with 😖 , 😓 & 🤮
Installation
Dependencies
Via Go
go get github.com/joshhhhyyyy/r2ools
go install github.com/joshhhhyyyy/r2ools
export PATH=$PATH:$(go env GOPATH)/bin
(Add gopath to path)
Via apt
echo "deb [trusted=yes] https://apt.joseos.com/ ./" | sudo tee /etc/apt/sources.list.d/joseos.list
sudo apt update
sudo apt install r2ools
Usage
Prerequisites
- Either:
- An environment variable named
endpoint
that contains your s3 api endpoint url,
OR
- An environment variable named
r2id
that contains your cloudflare user id
- An existing bucket in cloudflare r2 (this tool does not allow you to create or delete buckets)
Available Subcommands
r2 ls
or list
<bucket-name>
: lists all files in the bucket, lists all buckets if no name is supplied
r2 put <bucket> <path to file>
: uploads file
r2 get <bucket> <file to get> <output path>
: downloads file
r2 sign <bucket> <file> <expiresin>
: generate presigned url for file. Expiresin default: 3600s (1h)