R2

Wrangler

# 上传
wrangler r2 object put tmpfile/voyah.ipa --file=/绝对路径/voyah.ipa
# 查询
wrangler r2 object get tmpfile/voyah.ipa

Error: Wrangler only supports uploading files up to 300 MiB in size...

Wrangler 的 r2 object put 命令本身也限制单文件最大 300 MiB。改用支持 S3 兼容API 的图形工具分片上传,比如:

  • Cyberduck
  • Transmit
  • S3 Browser
  • rclone

这些工具本身是为S3写的

rclone

确认 rclone 已安装:

rclone version

如果没安装,macOS 可以用:

brew install rclone

获取 Cloudflare R2 的 S3 凭据

你需要 3 个信息:

  1. R2 Account ID
    • 在 Cloudflare Dashboard:R2 Object Storage → 右侧或页面顶部 → Account ID
  2. R2 Access Key ID
    • 在:R2 → Manage R2 API Tokens → Create API Token
    • 创建后会看到:
      • Access Key ID
      • Secret Access Key (注意保存)
  3. Bucket 名称

配置 rclone

rclone config

然后按下面步骤操作:

  1. 输入 n,新建 remote
  2. 输入名称, 比如: r2tmp
  3. 选择存储类型
    • 找到Amazon S3 Compliant Storage Providers
    • 然后选Cloudflare R2 Storage
    • 如果版本不同,也可以直接选数字对应的 s3,然后在 provider 中选择 Cloudflare R2。
  4. 输入 Access Key ID, 粘贴你刚才保存的。
  5. 输入 Secret Access Key
  6. 选择地域 auto
  7. Endpoint
    • 填写: https://<AccountID>.r2.cloudflarestorage.com
  8. 其他选项, 一般一路回车即可。
  9. 最后选y保存。

上传你的 ipa

配置完成后,假设你起的名字是 r2tmp,桶是 tmpfile:

rclone copy /本地路径/voyah.ipa r2tmp:tmpfile

说明:

  • r2tmp:tmpfile 意思是:
    • remote 名为 r2tmp (你在rclone里配置的)
    • 桶名为 tmpfile

上传成功后在 R2 里看到的 Key 是:

voyah.ipa

验证是否上传成功

rclone lsl r2tmp:tmpfile

如果看到 voyah.ipa,就说明真的传上去了。

其它命令

# 重新配置
rclone config
# 查看配置
rclone config show
# 列出文件
rclone lsl r2tmp:tmpfile/ipa # 即remote:bucket/path
rclone ls r2tmp:tmpfile # 格式更友好

小技巧

上传时应用随机文件名, 避免被遍历:

rclone copy ./a.png r2tmp:mybucket/$(uuidgen | tr 'A-Z' 'a-z')_a.png
rclone copy ./a.png r2tmp:mybucket/20260828_$(openssl rand -hex 8)_a.png

用aria2c下载:

aria2c -x 16 -s 16 -k 1M localname.ipa "https://example.com/file.ipa"
  • -x: 总体最多连接数 (理解为一个文件最多切成这么多片)
  • -s: 每服务器最多连接数
  • -k: 切片大小

多文件/任务下载:

aria2c -j 4 "file1.ipa" "file2.ipa" "file3.ipa" "file4.ipa"
  • -j: 并发任务数