R2 为您提供 S3 兼容的对象存储,无需支付出口费用
使用
$ wrangler r2 --help
wrangler r2
📦 Interact with an R2 store
Commands:
wrangler r2 object Manage R2 objects
wrangler r2 bucket Manage R2 buckets
Flags:
-j, --experimental-json-config Experimental: Support wrangler.json [boolean]
-c, --config Path to .toml configuration file [string]
-e, --env Environment to use for operations and .env files [string]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
示例
# 登录
wrangler login
# 创建 bucket
wrangler r2 bucket create foo
# 列出 bucket
wrangler r2 bucket list
- 与 worker 集成,修改配置文件
wrangler.toml
# Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#r2-buckets
# [[r2_buckets]]
# binding = "MY_BUCKET"
# bucket_name = "my-bucket"