rustfs-s3-toolkit


Namerustfs-s3-toolkit JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryRustFS S3 Storage Toolkit - A simple and powerful toolkit for RustFS and other S3-compatible object storage operations
upload_time2025-07-24 02:51:41
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords rustfs s3 object-storage file-management cloud-storage toolkit
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # RustFS S3 Storage Toolkit

一个专为 RustFS 设计的 S3 兼容对象存储工具包,同时支持其他各种 S3 兼容存储服务。提供完整的文件和目录操作功能,具有高度的可复用性和工具性。

## 🧪 测试环境

本工具包已在以下 RustFS 版本上完成全面测试:

```
rustfs 1.0.0-alpha.34
build time   : 2025-07-21 08:13:28 +00:00
build profile: release
build os     : linux-x86_64
rust version : rustc 1.88.0 (6b00bc388 2025-06-23)
rust channel : stable-x86_64-unknown-linux-gnu
git commit   : 3f095e75cb1276adf47a05472c8cc608eaa51504
git tag      : 1.0.0-alpha.34
```

**注意**: 虽然理论上兼容其他 S3 兼容服务,但建议在使用前进行自行测试以确保兼容性。

## 🚀 核心功能

本工具包提供以下 9 个核心功能,全部测试通过:

- ✅ **Connection (连接测试)**: 验证 S3 服务连接和存储桶访问权限
- ✅ **Upload File (上传文件)**: 上传单个文件到 S3 存储
- ✅ **Create Folder (创建文件夹)**: 在 S3 中创建文件夹结构
- ✅ **Upload Directory (上传目录)**: 递归上传整个目录及其子目录
- ✅ **Download File (下载文件)**: 从 S3 下载单个文件
- ✅ **Download Directory (下载目录)**: 下载整个目录及其所有文件
- ✅ **List Files (列出文件)**: 列出存储桶中的文件和目录
- ✅ **Delete File (删除文件)**: 删除 S3 中的单个文件
- ✅ **Delete Directory (删除目录)**: 删除整个目录及其所有文件

## 🎯 设计特点

- **易于使用**: 简单的类实例化和方法调用
- **高度可复用**: 一次配置,多次使用
- **工具性强**: 专注于核心功能,无冗余依赖
- **兼容性好**: 支持各种 S3 兼容存储服务
- **错误处理**: 完善的异常处理和错误信息返回
- **灵活配置**: 自动适配不同 S3 服务的签名要求

## 📦 安装

### 从 PyPI 安装 (推荐)

```bash
pip install rustfs-s3-toolkit
```

### 开发版本安装

```bash
# 克隆项目
git clone https://github.com/mm644706215/rustfs-s3-toolkit.git
cd rustfs-s3-toolkit

# 安装开发版本
pip install -e .
```

## 🔧 支持的存储服务

### 已测试服务
- **RustFS 1.0.0-alpha.34**: 主要测试目标,所有功能完全兼容 ✅

### 理论兼容服务(需自行测试)
- **AWS S3**: 亚马逊云存储服务
- **MinIO**: 开源对象存储服务
- **Alibaba Cloud OSS**: 阿里云对象存储
- **Tencent Cloud COS**: 腾讯云对象存储
- **其他 S3 兼容服务**: 任何支持 S3 API 的存储服务

**重要提示**: 除 RustFS 1.0.0-alpha.34 外,其他服务虽然理论上兼容,但建议在生产环境使用前进行充分测试。

## 📖 快速开始

### 基本使用

```python
from rustfs_s3_toolkit import S3StorageToolkit

# 初始化工具包(以 RustFS 为例)
toolkit = S3StorageToolkit(
    endpoint_url="https://your-rustfs-endpoint.com",
    access_key_id="your-access-key-id",
    secret_access_key="your-secret-access-key",
    bucket_name="your-bucket-name",
    region_name="us-east-1"  # 可选,默认 us-east-1
)

# 测试连接
result = toolkit.test_connection()
if result['success']:
    print(f"连接成功: {result['message']}")
else:
    print(f"连接失败: {result['error']}")
```

## 📚 详细使用方法

### 1. 连接测试 (Connection)

```python
# 测试 S3 连接和存储桶访问权限
result = toolkit.test_connection()

# 返回结果
{
    "success": True,
    "bucket_count": 5,
    "bucket_names": ["bucket1", "bucket2", ...],
    "target_bucket_exists": True,
    "message": "连接成功!找到 5 个存储桶"
}
```

### 2. 上传文件 (Upload File)

```python
# 上传单个文件
result = toolkit.upload_file(
    local_file_path="/path/to/local/file.txt",
    remote_key="remote/path/file.txt",
    metadata={"author": "user", "type": "document"}  # 可选
)

# 返回结果
{
    "success": True,
    "bucket": "your-bucket",
    "key": "remote/path/file.txt",
    "public_url": "https://endpoint/bucket/remote/path/file.txt",
    "file_size": 1024,
    "upload_time": "2024-01-01T12:00:00"
}
```

### 3. 创建文件夹 (Create Folder)

```python
# 创建文件夹(S3 中通过空对象实现)
result = toolkit.create_folder("my-folder/sub-folder/")

# 返回结果
{
    "success": True,
    "bucket": "your-bucket",
    "folder_path": "my-folder/sub-folder/",
    "create_time": "2024-01-01T12:00:00"
}
```

### 4. 上传目录 (Upload Directory)

```python
# 递归上传整个目录
result = toolkit.upload_directory(
    local_dir="/path/to/local/directory",
    remote_prefix="remote/directory/"
)

# 返回结果
{
    "success": True,
    "bucket": "your-bucket",
    "local_directory": "/path/to/local/directory",
    "remote_prefix": "remote/directory/",
    "uploaded_files": ["remote/directory/file1.txt", "remote/directory/sub/file2.txt"],
    "file_count": 2,
    "upload_time": "2024-01-01T12:00:00"
}
```

### 5. 下载文件 (Download File)

```python
# 下载单个文件
result = toolkit.download_file(
    remote_key="remote/path/file.txt",
    local_file_path="/path/to/save/file.txt"
)

# 返回结果
{
    "success": True,
    "bucket": "your-bucket",
    "key": "remote/path/file.txt",
    "local_path": "/path/to/save/file.txt",
    "file_size": 1024,
    "download_time": "2024-01-01T12:00:00"
}
```

### 6. 下载目录 (Download Directory)

```python
# 下载整个目录
result = toolkit.download_directory(
    remote_prefix="remote/directory/",
    local_dir="/path/to/save/directory"
)

# 返回结果
{
    "success": True,
    "bucket": "your-bucket",
    "remote_prefix": "remote/directory/",
    "local_directory": "/path/to/save/directory",
    "downloaded_files": ["/path/to/save/directory/file1.txt", ...],
    "file_count": 2,
    "download_time": "2024-01-01T12:00:00"
}
```

### 7. 列出文件 (List Files)

```python
# 列出存储桶中的文件
result = toolkit.list_files(
    prefix="my-folder/",  # 可选,过滤前缀
    max_keys=100         # 可选,最大返回数量
)

# 返回结果
{
    "success": True,
    "bucket": "your-bucket",
    "prefix": "my-folder/",
    "files": [
        {
            "key": "my-folder/file1.txt",
            "size": 1024,
            "last_modified": "2024-01-01T12:00:00",
            "public_url": "https://endpoint/bucket/my-folder/file1.txt"
        }
    ],
    "file_count": 1,
    "list_time": "2024-01-01T12:00:00"
}
```

### 8. 删除文件 (Delete File)

```python
# 删除单个文件
result = toolkit.delete_file("remote/path/file.txt")

# 返回结果
{
    "success": True,
    "bucket": "your-bucket",
    "key": "remote/path/file.txt",
    "delete_time": "2024-01-01T12:00:00"
}
```

### 9. 删除目录 (Delete Directory)

```python
# 删除整个目录及其所有文件
result = toolkit.delete_directory("remote/directory/")

# 返回结果
{
    "success": True,
    "bucket": "your-bucket",
    "remote_prefix": "remote/directory/",
    "deleted_count": 5,
    "delete_time": "2024-01-01T12:00:00"
}
```

## 🔧 配置说明

### 基本配置参数

| 参数 | 类型 | 必需 | 说明 |
|------|------|------|------|
| `endpoint_url` | str | ✅ | S3 服务端点 URL |
| `access_key_id` | str | ✅ | 访问密钥 ID |
| `secret_access_key` | str | ✅ | 访问密钥 |
| `bucket_name` | str | ✅ | 存储桶名称 |
| `region_name` | str | ❌ | 区域名称,默认 "us-east-1" |

### 常见配置示例

#### AWS S3
```python
toolkit = S3StorageToolkit(
    endpoint_url="https://s3.amazonaws.com",
    access_key_id="AKIAIOSFODNN7EXAMPLE",
    secret_access_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
    bucket_name="my-bucket",
    region_name="us-west-2"
)
```

#### MinIO
```python
toolkit = S3StorageToolkit(
    endpoint_url="http://localhost:9000",
    access_key_id="minioadmin",
    secret_access_key="minioadmin",
    bucket_name="my-bucket"
)
```

#### RustFS (已测试版本 1.0.0-alpha.34)
```python
toolkit = S3StorageToolkit(
    endpoint_url="https://your-rustfs-endpoint.com",
    access_key_id="your-access-key",
    secret_access_key="your-secret-key",
    bucket_name="your-bucket-name"
)
```

## 🧪 测试

运行完整的功能测试:

```bash
# 运行测试套件
python tests/test_toolkit.py

# 运行基本使用示例
python examples/basic_usage.py
```

测试将验证所有 9 个核心功能是否正常工作。

## 📁 项目结构

```
rustfs-s3-toolkit/
├── README.md                 # 项目文档
├── pyproject.toml           # 项目配置
├── LICENSE                  # MIT 许可证
├── install.py               # 安装脚本
├── build.py                 # 构建脚本
├── src/
│   └── rustfs_s3_toolkit/
│       ├── __init__.py      # 包初始化
│       └── s3_client.py     # 核心工具类
├── tests/
│   └── test_toolkit.py      # 测试套件
└── examples/
    └── basic_usage.py       # 使用示例
```

## 🤝 贡献

欢迎提交 Issue 和 Pull Request!

## 📄 许可证

MIT License

## 🔗 相关链接

- [GitHub 仓库](https://github.com/mm644706215/rustfs-s3-toolkit)
- [PyPI 包](https://pypi.org/project/rustfs-s3-toolkit/)
- [问题反馈](https://github.com/mm644706215/rustfs-s3-toolkit/issues)

---

**RustFS S3 Storage Toolkit** - 专为 RustFS 设计,让 S3 对象存储操作变得简单高效!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "rustfs-s3-toolkit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "rustfs, s3, object-storage, file-management, cloud-storage, toolkit",
    "author": null,
    "author_email": "mm644706215 <ze.ga@qq.com>",
    "download_url": "https://files.pythonhosted.org/packages/c8/8e/83d35444a0cf18a5d62fa51c31b7ebe1a3eb26a67b60b304865e6eb21ea3/rustfs_s3_toolkit-0.2.0.tar.gz",
    "platform": null,
    "description": "# RustFS S3 Storage Toolkit\n\n\u4e00\u4e2a\u4e13\u4e3a RustFS \u8bbe\u8ba1\u7684 S3 \u517c\u5bb9\u5bf9\u8c61\u5b58\u50a8\u5de5\u5177\u5305\uff0c\u540c\u65f6\u652f\u6301\u5176\u4ed6\u5404\u79cd S3 \u517c\u5bb9\u5b58\u50a8\u670d\u52a1\u3002\u63d0\u4f9b\u5b8c\u6574\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u64cd\u4f5c\u529f\u80fd\uff0c\u5177\u6709\u9ad8\u5ea6\u7684\u53ef\u590d\u7528\u6027\u548c\u5de5\u5177\u6027\u3002\n\n## \ud83e\uddea \u6d4b\u8bd5\u73af\u5883\n\n\u672c\u5de5\u5177\u5305\u5df2\u5728\u4ee5\u4e0b RustFS \u7248\u672c\u4e0a\u5b8c\u6210\u5168\u9762\u6d4b\u8bd5\uff1a\n\n```\nrustfs 1.0.0-alpha.34\nbuild time   : 2025-07-21 08:13:28 +00:00\nbuild profile: release\nbuild os     : linux-x86_64\nrust version : rustc 1.88.0 (6b00bc388 2025-06-23)\nrust channel : stable-x86_64-unknown-linux-gnu\ngit commit   : 3f095e75cb1276adf47a05472c8cc608eaa51504\ngit tag      : 1.0.0-alpha.34\n```\n\n**\u6ce8\u610f**: \u867d\u7136\u7406\u8bba\u4e0a\u517c\u5bb9\u5176\u4ed6 S3 \u517c\u5bb9\u670d\u52a1\uff0c\u4f46\u5efa\u8bae\u5728\u4f7f\u7528\u524d\u8fdb\u884c\u81ea\u884c\u6d4b\u8bd5\u4ee5\u786e\u4fdd\u517c\u5bb9\u6027\u3002\n\n## \ud83d\ude80 \u6838\u5fc3\u529f\u80fd\n\n\u672c\u5de5\u5177\u5305\u63d0\u4f9b\u4ee5\u4e0b 9 \u4e2a\u6838\u5fc3\u529f\u80fd\uff0c\u5168\u90e8\u6d4b\u8bd5\u901a\u8fc7\uff1a\n\n- \u2705 **Connection (\u8fde\u63a5\u6d4b\u8bd5)**: \u9a8c\u8bc1 S3 \u670d\u52a1\u8fde\u63a5\u548c\u5b58\u50a8\u6876\u8bbf\u95ee\u6743\u9650\n- \u2705 **Upload File (\u4e0a\u4f20\u6587\u4ef6)**: \u4e0a\u4f20\u5355\u4e2a\u6587\u4ef6\u5230 S3 \u5b58\u50a8\n- \u2705 **Create Folder (\u521b\u5efa\u6587\u4ef6\u5939)**: \u5728 S3 \u4e2d\u521b\u5efa\u6587\u4ef6\u5939\u7ed3\u6784\n- \u2705 **Upload Directory (\u4e0a\u4f20\u76ee\u5f55)**: \u9012\u5f52\u4e0a\u4f20\u6574\u4e2a\u76ee\u5f55\u53ca\u5176\u5b50\u76ee\u5f55\n- \u2705 **Download File (\u4e0b\u8f7d\u6587\u4ef6)**: \u4ece S3 \u4e0b\u8f7d\u5355\u4e2a\u6587\u4ef6\n- \u2705 **Download Directory (\u4e0b\u8f7d\u76ee\u5f55)**: \u4e0b\u8f7d\u6574\u4e2a\u76ee\u5f55\u53ca\u5176\u6240\u6709\u6587\u4ef6\n- \u2705 **List Files (\u5217\u51fa\u6587\u4ef6)**: \u5217\u51fa\u5b58\u50a8\u6876\u4e2d\u7684\u6587\u4ef6\u548c\u76ee\u5f55\n- \u2705 **Delete File (\u5220\u9664\u6587\u4ef6)**: \u5220\u9664 S3 \u4e2d\u7684\u5355\u4e2a\u6587\u4ef6\n- \u2705 **Delete Directory (\u5220\u9664\u76ee\u5f55)**: \u5220\u9664\u6574\u4e2a\u76ee\u5f55\u53ca\u5176\u6240\u6709\u6587\u4ef6\n\n## \ud83c\udfaf \u8bbe\u8ba1\u7279\u70b9\n\n- **\u6613\u4e8e\u4f7f\u7528**: \u7b80\u5355\u7684\u7c7b\u5b9e\u4f8b\u5316\u548c\u65b9\u6cd5\u8c03\u7528\n- **\u9ad8\u5ea6\u53ef\u590d\u7528**: \u4e00\u6b21\u914d\u7f6e\uff0c\u591a\u6b21\u4f7f\u7528\n- **\u5de5\u5177\u6027\u5f3a**: \u4e13\u6ce8\u4e8e\u6838\u5fc3\u529f\u80fd\uff0c\u65e0\u5197\u4f59\u4f9d\u8d56\n- **\u517c\u5bb9\u6027\u597d**: \u652f\u6301\u5404\u79cd S3 \u517c\u5bb9\u5b58\u50a8\u670d\u52a1\n- **\u9519\u8bef\u5904\u7406**: \u5b8c\u5584\u7684\u5f02\u5e38\u5904\u7406\u548c\u9519\u8bef\u4fe1\u606f\u8fd4\u56de\n- **\u7075\u6d3b\u914d\u7f6e**: \u81ea\u52a8\u9002\u914d\u4e0d\u540c S3 \u670d\u52a1\u7684\u7b7e\u540d\u8981\u6c42\n\n## \ud83d\udce6 \u5b89\u88c5\n\n### \u4ece PyPI \u5b89\u88c5 (\u63a8\u8350)\n\n```bash\npip install rustfs-s3-toolkit\n```\n\n### \u5f00\u53d1\u7248\u672c\u5b89\u88c5\n\n```bash\n# \u514b\u9686\u9879\u76ee\ngit clone https://github.com/mm644706215/rustfs-s3-toolkit.git\ncd rustfs-s3-toolkit\n\n# \u5b89\u88c5\u5f00\u53d1\u7248\u672c\npip install -e .\n```\n\n## \ud83d\udd27 \u652f\u6301\u7684\u5b58\u50a8\u670d\u52a1\n\n### \u5df2\u6d4b\u8bd5\u670d\u52a1\n- **RustFS 1.0.0-alpha.34**: \u4e3b\u8981\u6d4b\u8bd5\u76ee\u6807\uff0c\u6240\u6709\u529f\u80fd\u5b8c\u5168\u517c\u5bb9 \u2705\n\n### \u7406\u8bba\u517c\u5bb9\u670d\u52a1\uff08\u9700\u81ea\u884c\u6d4b\u8bd5\uff09\n- **AWS S3**: \u4e9a\u9a6c\u900a\u4e91\u5b58\u50a8\u670d\u52a1\n- **MinIO**: \u5f00\u6e90\u5bf9\u8c61\u5b58\u50a8\u670d\u52a1\n- **Alibaba Cloud OSS**: \u963f\u91cc\u4e91\u5bf9\u8c61\u5b58\u50a8\n- **Tencent Cloud COS**: \u817e\u8baf\u4e91\u5bf9\u8c61\u5b58\u50a8\n- **\u5176\u4ed6 S3 \u517c\u5bb9\u670d\u52a1**: \u4efb\u4f55\u652f\u6301 S3 API \u7684\u5b58\u50a8\u670d\u52a1\n\n**\u91cd\u8981\u63d0\u793a**: \u9664 RustFS 1.0.0-alpha.34 \u5916\uff0c\u5176\u4ed6\u670d\u52a1\u867d\u7136\u7406\u8bba\u4e0a\u517c\u5bb9\uff0c\u4f46\u5efa\u8bae\u5728\u751f\u4ea7\u73af\u5883\u4f7f\u7528\u524d\u8fdb\u884c\u5145\u5206\u6d4b\u8bd5\u3002\n\n## \ud83d\udcd6 \u5feb\u901f\u5f00\u59cb\n\n### \u57fa\u672c\u4f7f\u7528\n\n```python\nfrom rustfs_s3_toolkit import S3StorageToolkit\n\n# \u521d\u59cb\u5316\u5de5\u5177\u5305\uff08\u4ee5 RustFS \u4e3a\u4f8b\uff09\ntoolkit = S3StorageToolkit(\n    endpoint_url=\"https://your-rustfs-endpoint.com\",\n    access_key_id=\"your-access-key-id\",\n    secret_access_key=\"your-secret-access-key\",\n    bucket_name=\"your-bucket-name\",\n    region_name=\"us-east-1\"  # \u53ef\u9009\uff0c\u9ed8\u8ba4 us-east-1\n)\n\n# \u6d4b\u8bd5\u8fde\u63a5\nresult = toolkit.test_connection()\nif result['success']:\n    print(f\"\u8fde\u63a5\u6210\u529f: {result['message']}\")\nelse:\n    print(f\"\u8fde\u63a5\u5931\u8d25: {result['error']}\")\n```\n\n## \ud83d\udcda \u8be6\u7ec6\u4f7f\u7528\u65b9\u6cd5\n\n### 1. \u8fde\u63a5\u6d4b\u8bd5 (Connection)\n\n```python\n# \u6d4b\u8bd5 S3 \u8fde\u63a5\u548c\u5b58\u50a8\u6876\u8bbf\u95ee\u6743\u9650\nresult = toolkit.test_connection()\n\n# \u8fd4\u56de\u7ed3\u679c\n{\n    \"success\": True,\n    \"bucket_count\": 5,\n    \"bucket_names\": [\"bucket1\", \"bucket2\", ...],\n    \"target_bucket_exists\": True,\n    \"message\": \"\u8fde\u63a5\u6210\u529f\uff01\u627e\u5230 5 \u4e2a\u5b58\u50a8\u6876\"\n}\n```\n\n### 2. \u4e0a\u4f20\u6587\u4ef6 (Upload File)\n\n```python\n# \u4e0a\u4f20\u5355\u4e2a\u6587\u4ef6\nresult = toolkit.upload_file(\n    local_file_path=\"/path/to/local/file.txt\",\n    remote_key=\"remote/path/file.txt\",\n    metadata={\"author\": \"user\", \"type\": \"document\"}  # \u53ef\u9009\n)\n\n# \u8fd4\u56de\u7ed3\u679c\n{\n    \"success\": True,\n    \"bucket\": \"your-bucket\",\n    \"key\": \"remote/path/file.txt\",\n    \"public_url\": \"https://endpoint/bucket/remote/path/file.txt\",\n    \"file_size\": 1024,\n    \"upload_time\": \"2024-01-01T12:00:00\"\n}\n```\n\n### 3. \u521b\u5efa\u6587\u4ef6\u5939 (Create Folder)\n\n```python\n# \u521b\u5efa\u6587\u4ef6\u5939\uff08S3 \u4e2d\u901a\u8fc7\u7a7a\u5bf9\u8c61\u5b9e\u73b0\uff09\nresult = toolkit.create_folder(\"my-folder/sub-folder/\")\n\n# \u8fd4\u56de\u7ed3\u679c\n{\n    \"success\": True,\n    \"bucket\": \"your-bucket\",\n    \"folder_path\": \"my-folder/sub-folder/\",\n    \"create_time\": \"2024-01-01T12:00:00\"\n}\n```\n\n### 4. \u4e0a\u4f20\u76ee\u5f55 (Upload Directory)\n\n```python\n# \u9012\u5f52\u4e0a\u4f20\u6574\u4e2a\u76ee\u5f55\nresult = toolkit.upload_directory(\n    local_dir=\"/path/to/local/directory\",\n    remote_prefix=\"remote/directory/\"\n)\n\n# \u8fd4\u56de\u7ed3\u679c\n{\n    \"success\": True,\n    \"bucket\": \"your-bucket\",\n    \"local_directory\": \"/path/to/local/directory\",\n    \"remote_prefix\": \"remote/directory/\",\n    \"uploaded_files\": [\"remote/directory/file1.txt\", \"remote/directory/sub/file2.txt\"],\n    \"file_count\": 2,\n    \"upload_time\": \"2024-01-01T12:00:00\"\n}\n```\n\n### 5. \u4e0b\u8f7d\u6587\u4ef6 (Download File)\n\n```python\n# \u4e0b\u8f7d\u5355\u4e2a\u6587\u4ef6\nresult = toolkit.download_file(\n    remote_key=\"remote/path/file.txt\",\n    local_file_path=\"/path/to/save/file.txt\"\n)\n\n# \u8fd4\u56de\u7ed3\u679c\n{\n    \"success\": True,\n    \"bucket\": \"your-bucket\",\n    \"key\": \"remote/path/file.txt\",\n    \"local_path\": \"/path/to/save/file.txt\",\n    \"file_size\": 1024,\n    \"download_time\": \"2024-01-01T12:00:00\"\n}\n```\n\n### 6. \u4e0b\u8f7d\u76ee\u5f55 (Download Directory)\n\n```python\n# \u4e0b\u8f7d\u6574\u4e2a\u76ee\u5f55\nresult = toolkit.download_directory(\n    remote_prefix=\"remote/directory/\",\n    local_dir=\"/path/to/save/directory\"\n)\n\n# \u8fd4\u56de\u7ed3\u679c\n{\n    \"success\": True,\n    \"bucket\": \"your-bucket\",\n    \"remote_prefix\": \"remote/directory/\",\n    \"local_directory\": \"/path/to/save/directory\",\n    \"downloaded_files\": [\"/path/to/save/directory/file1.txt\", ...],\n    \"file_count\": 2,\n    \"download_time\": \"2024-01-01T12:00:00\"\n}\n```\n\n### 7. \u5217\u51fa\u6587\u4ef6 (List Files)\n\n```python\n# \u5217\u51fa\u5b58\u50a8\u6876\u4e2d\u7684\u6587\u4ef6\nresult = toolkit.list_files(\n    prefix=\"my-folder/\",  # \u53ef\u9009\uff0c\u8fc7\u6ee4\u524d\u7f00\n    max_keys=100         # \u53ef\u9009\uff0c\u6700\u5927\u8fd4\u56de\u6570\u91cf\n)\n\n# \u8fd4\u56de\u7ed3\u679c\n{\n    \"success\": True,\n    \"bucket\": \"your-bucket\",\n    \"prefix\": \"my-folder/\",\n    \"files\": [\n        {\n            \"key\": \"my-folder/file1.txt\",\n            \"size\": 1024,\n            \"last_modified\": \"2024-01-01T12:00:00\",\n            \"public_url\": \"https://endpoint/bucket/my-folder/file1.txt\"\n        }\n    ],\n    \"file_count\": 1,\n    \"list_time\": \"2024-01-01T12:00:00\"\n}\n```\n\n### 8. \u5220\u9664\u6587\u4ef6 (Delete File)\n\n```python\n# \u5220\u9664\u5355\u4e2a\u6587\u4ef6\nresult = toolkit.delete_file(\"remote/path/file.txt\")\n\n# \u8fd4\u56de\u7ed3\u679c\n{\n    \"success\": True,\n    \"bucket\": \"your-bucket\",\n    \"key\": \"remote/path/file.txt\",\n    \"delete_time\": \"2024-01-01T12:00:00\"\n}\n```\n\n### 9. \u5220\u9664\u76ee\u5f55 (Delete Directory)\n\n```python\n# \u5220\u9664\u6574\u4e2a\u76ee\u5f55\u53ca\u5176\u6240\u6709\u6587\u4ef6\nresult = toolkit.delete_directory(\"remote/directory/\")\n\n# \u8fd4\u56de\u7ed3\u679c\n{\n    \"success\": True,\n    \"bucket\": \"your-bucket\",\n    \"remote_prefix\": \"remote/directory/\",\n    \"deleted_count\": 5,\n    \"delete_time\": \"2024-01-01T12:00:00\"\n}\n```\n\n## \ud83d\udd27 \u914d\u7f6e\u8bf4\u660e\n\n### \u57fa\u672c\u914d\u7f6e\u53c2\u6570\n\n| \u53c2\u6570 | \u7c7b\u578b | \u5fc5\u9700 | \u8bf4\u660e |\n|------|------|------|------|\n| `endpoint_url` | str | \u2705 | S3 \u670d\u52a1\u7aef\u70b9 URL |\n| `access_key_id` | str | \u2705 | \u8bbf\u95ee\u5bc6\u94a5 ID |\n| `secret_access_key` | str | \u2705 | \u8bbf\u95ee\u5bc6\u94a5 |\n| `bucket_name` | str | \u2705 | \u5b58\u50a8\u6876\u540d\u79f0 |\n| `region_name` | str | \u274c | \u533a\u57df\u540d\u79f0\uff0c\u9ed8\u8ba4 \"us-east-1\" |\n\n### \u5e38\u89c1\u914d\u7f6e\u793a\u4f8b\n\n#### AWS S3\n```python\ntoolkit = S3StorageToolkit(\n    endpoint_url=\"https://s3.amazonaws.com\",\n    access_key_id=\"AKIAIOSFODNN7EXAMPLE\",\n    secret_access_key=\"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\",\n    bucket_name=\"my-bucket\",\n    region_name=\"us-west-2\"\n)\n```\n\n#### MinIO\n```python\ntoolkit = S3StorageToolkit(\n    endpoint_url=\"http://localhost:9000\",\n    access_key_id=\"minioadmin\",\n    secret_access_key=\"minioadmin\",\n    bucket_name=\"my-bucket\"\n)\n```\n\n#### RustFS (\u5df2\u6d4b\u8bd5\u7248\u672c 1.0.0-alpha.34)\n```python\ntoolkit = S3StorageToolkit(\n    endpoint_url=\"https://your-rustfs-endpoint.com\",\n    access_key_id=\"your-access-key\",\n    secret_access_key=\"your-secret-key\",\n    bucket_name=\"your-bucket-name\"\n)\n```\n\n## \ud83e\uddea \u6d4b\u8bd5\n\n\u8fd0\u884c\u5b8c\u6574\u7684\u529f\u80fd\u6d4b\u8bd5\uff1a\n\n```bash\n# \u8fd0\u884c\u6d4b\u8bd5\u5957\u4ef6\npython tests/test_toolkit.py\n\n# \u8fd0\u884c\u57fa\u672c\u4f7f\u7528\u793a\u4f8b\npython examples/basic_usage.py\n```\n\n\u6d4b\u8bd5\u5c06\u9a8c\u8bc1\u6240\u6709 9 \u4e2a\u6838\u5fc3\u529f\u80fd\u662f\u5426\u6b63\u5e38\u5de5\u4f5c\u3002\n\n## \ud83d\udcc1 \u9879\u76ee\u7ed3\u6784\n\n```\nrustfs-s3-toolkit/\n\u251c\u2500\u2500 README.md                 # \u9879\u76ee\u6587\u6863\n\u251c\u2500\u2500 pyproject.toml           # \u9879\u76ee\u914d\u7f6e\n\u251c\u2500\u2500 LICENSE                  # MIT \u8bb8\u53ef\u8bc1\n\u251c\u2500\u2500 install.py               # \u5b89\u88c5\u811a\u672c\n\u251c\u2500\u2500 build.py                 # \u6784\u5efa\u811a\u672c\n\u251c\u2500\u2500 src/\n\u2502   \u2514\u2500\u2500 rustfs_s3_toolkit/\n\u2502       \u251c\u2500\u2500 __init__.py      # \u5305\u521d\u59cb\u5316\n\u2502       \u2514\u2500\u2500 s3_client.py     # \u6838\u5fc3\u5de5\u5177\u7c7b\n\u251c\u2500\u2500 tests/\n\u2502   \u2514\u2500\u2500 test_toolkit.py      # \u6d4b\u8bd5\u5957\u4ef6\n\u2514\u2500\u2500 examples/\n    \u2514\u2500\u2500 basic_usage.py       # \u4f7f\u7528\u793a\u4f8b\n```\n\n## \ud83e\udd1d \u8d21\u732e\n\n\u6b22\u8fce\u63d0\u4ea4 Issue \u548c Pull Request\uff01\n\n## \ud83d\udcc4 \u8bb8\u53ef\u8bc1\n\nMIT License\n\n## \ud83d\udd17 \u76f8\u5173\u94fe\u63a5\n\n- [GitHub \u4ed3\u5e93](https://github.com/mm644706215/rustfs-s3-toolkit)\n- [PyPI \u5305](https://pypi.org/project/rustfs-s3-toolkit/)\n- [\u95ee\u9898\u53cd\u9988](https://github.com/mm644706215/rustfs-s3-toolkit/issues)\n\n---\n\n**RustFS S3 Storage Toolkit** - \u4e13\u4e3a RustFS \u8bbe\u8ba1\uff0c\u8ba9 S3 \u5bf9\u8c61\u5b58\u50a8\u64cd\u4f5c\u53d8\u5f97\u7b80\u5355\u9ad8\u6548\uff01\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "RustFS S3 Storage Toolkit - A simple and powerful toolkit for RustFS and other S3-compatible object storage operations",
    "version": "0.2.0",
    "project_urls": {
        "Documentation": "https://github.com/mm644706215/rustfs-s3-toolkit#readme",
        "Homepage": "https://github.com/mm644706215/rustfs-s3-toolkit",
        "Issues": "https://github.com/mm644706215/rustfs-s3-toolkit/issues",
        "Repository": "https://github.com/mm644706215/rustfs-s3-toolkit"
    },
    "split_keywords": [
        "rustfs",
        " s3",
        " object-storage",
        " file-management",
        " cloud-storage",
        " toolkit"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5cfe7bf1ff15281e2723213a02fe9a320bc07cf370774e460def51df255bf928",
                "md5": "1ab289531cf6c782c21176e5f9e96651",
                "sha256": "3e3af9f2c61525d6a62c0d40eedf944b72abfe396703148b5406f88c5b78295c"
            },
            "downloads": -1,
            "filename": "rustfs_s3_toolkit-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1ab289531cf6c782c21176e5f9e96651",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 10313,
            "upload_time": "2025-07-24T02:51:39",
            "upload_time_iso_8601": "2025-07-24T02:51:39.369363Z",
            "url": "https://files.pythonhosted.org/packages/5c/fe/7bf1ff15281e2723213a02fe9a320bc07cf370774e460def51df255bf928/rustfs_s3_toolkit-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c88e83d35444a0cf18a5d62fa51c31b7ebe1a3eb26a67b60b304865e6eb21ea3",
                "md5": "fdb2feb1caf4414f9c7b3897a936db02",
                "sha256": "8f8e33ad7ca151fc80989b513f8485350f1c0fd1d2131158e04917e1e4ba9298"
            },
            "downloads": -1,
            "filename": "rustfs_s3_toolkit-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "fdb2feb1caf4414f9c7b3897a936db02",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 15088,
            "upload_time": "2025-07-24T02:51:41",
            "upload_time_iso_8601": "2025-07-24T02:51:41.129234Z",
            "url": "https://files.pythonhosted.org/packages/c8/8e/83d35444a0cf18a5d62fa51c31b7ebe1a3eb26a67b60b304865e6eb21ea3/rustfs_s3_toolkit-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-24 02:51:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mm644706215",
    "github_project": "rustfs-s3-toolkit#readme",
    "github_not_found": true,
    "lcname": "rustfs-s3-toolkit"
}
        
Elapsed time: 0.56544s