@erento/nestjs-module-aws
v4.0.0
Published
NestJS module for communication with AWS.
Downloads
13
Keywords
Readme
NestJS AWS module
Currently supports:
- S3 upload
How to use it
Import this module in the module you want to use it as:
imports: [ AwsModule.forRoot( 'eu-west-1', 'my-bucket-name', 'my/folder-structure', './config/aws.credentials.json', ), ]
Upload a file:
Import the
S3Client
service via dependency injection to your service and use it as follows:Body as a text:
await this.S3Client.upload('folder/file-name.jpg', 'some text');
Body as a
@UploadedFile
fromFileInterceptor
:await this.S3Client.upload('folder/file-name.jpg', uploadedFile.buffer);
You can also provide S3 upload options to any request via 3rd argument.
Stay in touch
License
This module is MIT licensed.