- 🗂️ **多存储后端**: 本地文件系统、AWS S3、MinIO、阿里云 OSS、腾讯云 COS
- 📤 **TUS 上传**: 支持可恢复的大文件上传
- 🔧 **Hono 集成**: 提供即插即用的中间件
- 📊 **文件管理**: 完整的文件生命周期管理
- ⏰ **自动清理**: 过期文件自动清理机制
- 🔄 **存储迁移**: 支持不同存储类型间的数据迁移
### API 端点
```bash
# 文件资源管理
GET /api/storage/resources # 获取所有资源
GET /api/storage/resource/:fileId # 获取文件信息
DELETE /api/storage/resource/:id # 删除资源
# 文件访问和下载
GET /download/:fileId # 文件下载和访问(支持所有存储类型)
# 统计和管理
GET /api/storage/stats # 获取统计信息
POST /api/storage/cleanup # 清理过期文件
POST /api/storage/migrate-storage # 迁移存储类型
# 文件上传 (TUS 协议)
POST /upload # 开始上传
PATCH /upload/:id # 续传文件
HEAD /upload/:id # 获取上传状态
```
### 使用示例
```typescript
import { createStorageApp, startCleanupScheduler } from '@repo/storage';
// 创建存储应用
const storageApp = createStorageApp({
apiBasePath: '/api/storage',
uploadPath: '/upload',
});
// 挂载到主应用
app.route('/', storageApp);
// 启动清理调度器
startCleanupScheduler();
```
## One-click Deploy
You can deploy this template to Vercel with the button below:
[](https://vercel.com/new/clone?build-command=cd+..%2F..%2F+%26%26+pnpm+turbo+build+--filter%3Dweb...&demo-description=This+is+a+template+Turborepo+with+ShadcnUI+tailwindv4&demo-image=%2F%2Fimages.ctfassets.net%2Fe5382hct74si%2F2JxNyYATuuV7WPuJ31kF9Q%2F433990aa4c8e7524a9095682fb08f0b1%2FBasic.png&demo-title=Turborepo+%26+Next.js+Starter&demo-url=https%3A%2F%2Fexamples-basic-web.vercel.sh%2F&from=templates&project-name=Turborepo+%26+Next.js+Starter&repository-name=turborepo-shadcn-tailwind&repository-url=https%3A%2F%2Flinkb15%2Fturborepo-shadcn-ui-tailwind-4&root-directory=apps%2Fweb&skippable-integrations=1)