npm

@erento/nestjs-module-aws
TypeScript icon, indicating that this package has built-in type declarations

4.0.0 • Public • Published

NestJS AWS module

Currently supports:

  • S3 upload

How to use it

  1. 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',
        ),
    ]
  2. 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 from FileInterceptor:

      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.

Readme

Keywords

none

Package Sidebar

Install

npm i @erento/nestjs-module-aws

Weekly Downloads

11

Version

4.0.0

License

MIT

Unpacked Size

20.5 kB

Total Files

15

Last publish

Collaborators

  • maria.eltsova
  • blazn99
  • rokerkony
  • aljazb