简介
R2 Storage
原始描述
Manage Cloudflare R2 object storage (upload, download, list, delete, presigned URLs) using boto3 S3-compatible API. Supports CLI usage and importable Python...
通过你的 Agent 添加
安装目录:r2-storage/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: r2-storage
description: >
Manage Cloudflare R2 object storage (upload, download, list, delete, presigned URLs)
using boto3 S3-compatible API. Supports CLI usage and importable Python module.
license: MIT
metadata:
author: Jack2
tags: cloudflare, r2, s3, storage
r2-storage Skill
Manage Cloudflare R2 buckets and objects via the S3-compatible API. Uses boto3 under the hood.
When to Use This Skill
Use this skill whenever Marouane needs to:
- Upload files to R2 (backups, assets, media)
- Download files from R2
- List bucket contents
- Delete objects
- Generate temporary pre-signed URLs for sharing
Credentials
Set via environment variables (defaults are pre-configured for Marouane's account):
| Variable | Description |
|---|---|
R2_ACCESS_KEY_ID |
R2 Access Key ID |
R2_SECRET_ACCESS_KEY |
R2 Secret Access Key |
R2_ENDPOINT |
R2 endpoint URL |
R2_ACCOUNT_ID |
Cloudflare Account ID |
CLI Usage
# Upload
python3 scripts/r2.py upload myfile.txt my-bucket
python3 scripts/r2.py upload myfile.txt my-bucket --key folder/myfile.txt
# Download
python3 scripts/r2.py download my-bucket/folder/myfile.txt ./local-copy.txt
# List
python3 scripts/r2.py list my-bucket
python3 scripts/r2.py list my-bucket --prefix folder/
# Delete
python3 scripts/r2.py delete my-bucket/folder/myfile.txt
# Pre-signed URL (default 1h)
python3 scripts/r2.py presign my-bucket/folder/myfile.txt
python3 scripts/r2.py presign my-bucket/folder/myfile.txt --expires 86400
Python Import Usage
from scripts.r2 import upload, download, list_objects, delete, presign
# Upload
upload("local.txt", "my-bucket", key="optional/key.txt")
# List
objects = list_objects("my-bucket", prefix="folder/")
for obj in objects:
print(obj["key"], obj["size"])
# Pre-signed URL
url = presign("my-bucket", "folder/file.txt", expires=3600)
Requirements
- Python 3.8+
boto3 (python3-boto3 on Ubuntu — already installed on vps118558)
Notes
- Cloudflare R2 is S3-compatible; standard boto3 patterns apply.
- Pre-signed URLs work for GET requests only (public download links).
- The
region_name="auto" is required for R2 compatibility.
# Upload
python3 scripts/r2.py upload myfile.txt my-bucket
python3 scripts/r2.py upload myfile.txt my-bucket --key folder/myfile.txt
# Download
python3 scripts/r2.py download my-bucket/folder/myfile.txt ./local-copy.txt
# List
python3 scripts/r2.py list my-bucket
python3 scripts/r2.py list my-bucket --prefix folder/
# Delete
python3 scripts/r2.py delete my-bucket/folder/myfile.txt
# Pre-signed URL (default 1h)
python3 scripts/r2.py presign my-bucket/folder/myfile.txt
python3 scripts/r2.py presign my-bucket/folder/myfile.txt --expires 86400
from scripts.r2 import upload, download, list_objects, delete, presign
# Upload
upload("local.txt", "my-bucket", key="optional/key.txt")
# List
objects = list_objects("my-bucket", prefix="folder/")
for obj in objects:
print(obj["key"], obj["size"])
# Pre-signed URL
url = presign("my-bucket", "folder/file.txt", expires=3600)
Requirements
- Python 3.8+
boto3 (python3-boto3 on Ubuntu — already installed on vps118558)
Notes
- Cloudflare R2 is S3-compatible; standard boto3 patterns apply.
- Pre-signed URLs work for GET requests only (public download links).
- The
region_name="auto" is required for R2 compatibility.
boto3 (python3-boto3 on Ubuntu — already installed on vps118558)- Cloudflare R2 is S3-compatible; standard boto3 patterns apply.
- Pre-signed URLs work for GET requests only (public download links).
- The
region_name="auto"is required for R2 compatibility.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。