@dataclouder/nest-storage
v1.0.3
Published
NestJS library for storage services
Maintainers
Readme
@dataclouder/nest-storage
NestJS library for storage services, providing a unified interface for Google Cloud Storage, Cloudflare R2, Minio, and Local storage.
Installation
npm install @dataclouder/nest-storageFeatures
- Multi-Provider Support: Integrated support for Google Cloud Storage, Cloudflare R2, and Minio.
- Unified Interface: Use the same methods regardless of the underlying storage service.
- Image Processing: Automatic conversion of images to WebP format for optimized web delivery.
- Batch Operations: Easily remove all storage files referenced within complex data objects or by URLs.
- Security: Generate signed URLs for temporary access to private files.
- Auditable: Built-in support for tracking uploads with auditable metadata.
Documentation
For detailed guides and API references, please check the documentation files:
Basic Usage
- Register the module:
import { StorageModule } from '@dataclouder/nest-storage';
@Module({
imports: [
StorageModule.register({
provider: 'GOOGLE', // or 'CLOUDFLARE', 'MINIO', 'LOCAL'
bucket: 'my-bucket',
// ... provider specific config
}),
],
})
export class AppModule {}- Inject the service:
import { StorageService } from '@dataclouder/nest-storage';
@Injectable()
export class MyService {
constructor(private storageService: StorageService) {}
async uploadFile(file: Buffer, filename: string) {
return await this.storageService.upload(file, filename);
}
}Developed by dataclouder.
