Getting Started
This module provides a straightforward way to work with file storage in NestJS applications, primarily focusing on AWS S3 storage.
примітка
Ensure you have AWS credentials set up for accessing S3.
Installation
To begin using the File Storage Module, you need to install the package in your project:
yarn add @softkit/file-storage
Basic Setup
To get started, import and configure the S3FileStorageModule
in your NestJS application.
import { Module } from '@nestjs/common';
import { S3FileStorageModule } from '@softkit/file-storage';
@Module({
imports: [S3FileStorageModule.forRoot()],
})
export class YourAppModule {}
Configuration
Configure the module to suit your needs, including overriding default credentials and setting up asynchronous configurations.
Overriding Credentials
@Module({
imports: [
S3FileStorageModule.forRoot({
credentials: {
accessKeyId: 'test',
secretAccessKey: 'test',
},
}),
],
})
export class YourAppModule {}
Asynchronous Configuration
@Module({
imports: [
S3FileStorageModule.forRootAsync({
useFactory: async (config: SomeS3Config) => {
return config;
},
inject: [SomeS3Config],
}),
],
})
export class YourAppModule {}
Next Steps
- Explore Testing with LocalStack for a local development environment.
- Learn about Advanced Features and Customization to enhance your file storage capabilities.