@xnestjs/storage
v1.12.3
Published
NestJS extension library for Storage solutions (S3,GS)
Readme
@xnestjs/storage
NestJS extension library for Storage solutions (S3,GS)
Install
npm install @xnestjs/storage
# or using yarn
yarn add @xnestjs/storageUsage
Register sync
An example of nestjs module that import the @xnestjs/storage
// module.ts
import { Module } from '@nestjs/common';
import { StorageModule } from '@xnestjs/storage';
@Module({
imports: [
StorageModule.forRoot({
useValue: {
provider: 's3',
s3: {
endPoint: 'play.min.io',
port: 9000,
useSSL: true,
accessKey: 'accessKey',
secretKey: 'secretKey',
},
},
}),
],
})
export class MyModule {}Register async
An example of nestjs module that import the @xnestjs/mongodb async
// module.ts
import { Module } from '@nestjs/common';
import { StorageModule } from '@xnestjs/storage';
@Module({
imports: [
StorageModule.forRootAsync({
inject: [ConfigModule],
useFactory: (config: ConfigService) => ({
provider: 's3',
s3: {
endPoint: config.get('S3_ENDPOINT'),
},
}),
}),
],
})
export class MyModule {}Environment Variables
The library supports configuration through environment variables. Environment variables below is accepted. All environment variables starts with prefix (STORAGE_). This can be configured while registering the module.
