CloudflareR2
This package is a fork from Minio.jl. This is also not an official Cloudflare package.
This package provides Julia tools for working with Cloudflare R2. Cloudflare R2 is fully compatible with the AWS S3 interface, so interaction with R2 is achieved through AWSS3.jl. This package simply contains some convenient constructors to set up the configuration to be used with AWSS3.jl.
Installation
The package itself can be installed with
Pkg.add("CloudflareR2")
or ]add CloudflareR2
in the REPL.
Client
This package provides a AbstractAWSConfig
object to be used with Cloudflare R2. This allows seamless integration with the AWSS3.jl package.
CloudflareR2.R2Config
— TypeR2Config
A configuration object allowing to use the AWS S3 interface from AWS.jl and AWSS3.jl with Cloudflare R2. You can generate your access key ID and secret access key from the R2 dashboard, as well as your account ID from the Cloudflare dashboard.
Constructors
# By passing only your Cloudflare account ID
R2Config(account_id; access_key_id, secret_access_key, region)
R2Config(account_id, creds; region)
# By passing the endpoint directly
using URIs
R2Config(URI(endpoint); access_key_id, secret_access_key, region)
R2Config(URI(endpoint), creds; region)
Arguments
account_id
: Your Cloudflare account ID. This will be used to construct the endpoint URL.endpoint
: Your Cloudflare S3 API endpoint.creds
: AnAWSCredentials
object providing the credentials to access R2.access_key_id
: An access key ID for Cloudflare R2. This will useR2_ACCESS_KEY_ID
orAWS_ACCESS_KEY_ID
if available.secret_access_key
: A secret access key for Cloudflare R2. This will useR2_SECRET_ACCESS_KEY
orAWS_SECRET_ACCESS_KEY
if available.region
: The region to use. Defaults to"auto"
. Valid values are"auto"
,"wnam"
,"enam"
,"weur"
,"eeur"
, and"apac"
.
Examples
using R2
# tokens are read from environment
# region set to auto
config = R2Config("YOUR_ACCOUNT_ID")
# using the AWS S3 API
s3_list_buckets(config)
# using the S3Path interface
path = S3Path("s3://bucket-name", config=config)
readdir(path)