nest-image-resizer
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

nestjs-image-resizer-upload

Resize and upload images to google cloud storage

install

  npm install --save 'nest-image-resizer'

setup

async import

YOUR_GOOGLE_CLOUD_CREDENTIALS = path to your google service account file that gives you permission to upload files to a bucket

@Module({
  imports: [
    ImageResizerModule.registerAsync({
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory(config: ConfigService) {
        return {
          projectId: config.get('YOUR_GOOGLE_CLOUD_PROJECT_ID'),
          keyFilename: config.get('YOUR_GOOGLE_CLOUD_CREDENTIALS'),
          bucket: config.get('YOUR_GOOGLE_CLOUD_BUCKET_NAME'),
        };
      },
    }),
  ],
})

Using the service

 
import { ImageResizerService } from 'nest-image-resizer';
 
export class YourService {
  constructor(
    private readonly imageResizerService: ImageResizerService,
  ) {}
}

Readme

Keywords

none

Package Sidebar

Install

npm i nest-image-resizer

Weekly Downloads

1

Version

0.0.8

License

none

Unpacked Size

19.1 kB

Total Files

29

Last publish

Collaborators

  • drbeckert