TinyShip 1.3.0 Released
This version completes the core storage service integration, featuring a Unified cloud storage interface design that supports seamless multi-platform switching, providing flexible and reliable file storage capabilities.
β¨ Core Additions
Unified Storage Interface: Using the Unified design pattern, one API adapts to multiple cloud storage providers
Multi-Platform Support: Out-of-the-box support for three major cloud storage platforms
- Alibaba Cloud OSS (China preferred)
- AWS S3 (Global standard)
- Cloudflare R2 (Zero egress fees)
Flexible Switching: Easily switch between providers through configuration, no business code changes required
π§ Features
File Upload/Download: Support for large file chunked upload and resumable transfer
Signed URL Generation: Secure temporary access links with customizable expiration time
Metadata Management: Complete file metadata read/write capabilities
Directory Listing: Support for directory structure browsing and file list queries
π¦ Usage Example
import { createStorageProvider } from '@libs/storage';
// Create storage instance (auto-selects provider based on config)
const storage = createStorageProvider();
// Upload file
await storage.upload('path/to/file.jpg', fileBuffer);
// Generate signed URL
const signedUrl = await storage.getSignedUrl('path/to/file.jpg', {
expiresIn: 3600 // 1 hour expiration
});
// List directory
const files = await storage.list('uploads/');π Provider Comparison
| Provider | Features | Recommended For |
|---|---|---|
| Alibaba Cloud OSS | Fast China access, stable | China-focused users |
| AWS S3 | Global standard, rich ecosystem | International business |
| Cloudflare R2 | Zero egress fees, CDN integration | Cost-sensitive projects |