- S3 upload
-
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.
-
This module is MIT licensed.