Skip to content

codebrewlab/nestjs-storage

Repository files navigation

Nest Logo

nestjs-storage is manage file Storage wrapping package flydrive

NPM Version Package License NPM Downloads

Installation

$ npm i --save @codebrew/nestjs-storage @slynova/flydrive

# optional with s3 driver
$ npm i --save @slynova/flydrive-s3

# optional with gcs driver
$ npm i --save @slynova/flydrive-gcs

Example

// app.module.ts
import { Module } from '@nestjs/common'
import { StorageModule, DriverType } from '@codebrew/nestjs-storage';

@Module({
  imports: [StorageModule.forRoot({
    module: AppModule,
    imports: [
      StorageModule.forRoot({
        default: 'local',
        disks: {
          local: {
            driver: DriverType.LOCAL,
            config: {
              root: process.cwd(),
            },
          },
        },
      }),
    ],
  })]
})
export class AppModule {
  constructor(private storage: StorageServic) {
    this.storage.getDisk().put('test.txt', 'text content');
  }
}

Support

nestjs-storage is an MIT-licensed open source project. If this library is helpful, please click star to support it.

Stay in touch

License

nestjs-storage is MIT licensed.