Gathering detailed insights and metrics for @nestjs-mod/minio
Gathering detailed insights and metrics for @nestjs-mod/minio
Gathering detailed insights and metrics for @nestjs-mod/minio
Gathering detailed insights and metrics for @nestjs-mod/minio
npm install @nestjs-mod/minio
Typescript
Module System
Min. Node Version
Node Version
NPM Version
two-factor-v1.1.7
Updated on Jul 08, 2025
two-factor-v1.1.6
Updated on Jul 08, 2025
notifications-v1.2.5
Updated on Jul 08, 2025
two-factor-v1.1.5
Updated on Jul 08, 2025
files-v1.2.5
Updated on Jul 08, 2025
supabase-v1.2.3
Updated on Jul 08, 2025
TypeScript (96.75%)
JavaScript (2.51%)
Shell (0.45%)
HTML (0.28%)
Less (0.01%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
8 Stars
765 Commits
2 Forks
1 Watchers
1 Branches
2 Contributors
Updated on Jul 08, 2025
Latest Version
1.5.0
Package Id
@nestjs-mod/minio@1.5.0
Unpacked Size
73.03 kB
Size
15.86 kB
File Count
32
NPM Version
10.9.2
Node Version
23.11.1
Published on
May 24, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
6
Minio client for NestJS-mod (Wrapper for https://www.npmjs.com/package/nestjs-minio)
1npm i --save minio@7.1.3 nestjs-minio@2.5.4 @nestjs-mod/minio
Link | Category | Description |
---|---|---|
MinioModule | core | Minio client for NestJS-mod (Wrapper for https://www.npmjs.com/package/nestjs-minio) |
Minio client for NestJS-mod (Wrapper for https://www.npmjs.com/package/nestjs-minio)
A simple example of generating a link to upload and download a picture.
1import { NestFactory } from '@nestjs/core'; 2 3import { DefaultBucketNames, MinioFilesService, MinioModule, PresignedUrlsRequest } from '@nestjs-mod/minio'; 4import { Controller, Get, Module, Query } from '@nestjs/common'; 5import { lastValueFrom } from 'rxjs'; 6 7@Controller() 8export class AppController { 9 constructor(private readonly minioFilesService: MinioFilesService) {} 10 11 @Get('images-presigned-url') 12 getImagesPresignedUrl(@Query() request: PresignedUrlsRequest) { 13 return this.minioFilesService.getPresignedUrls({ 14 bucketName: DefaultBucketNames.images, 15 expiry: 60, 16 ext: request.ext, 17 }); 18 } 19 20 @Get('video-presigned-url') 21 getVideoPresignedUrl(@Query() request: PresignedUrlsRequest) { 22 return this.minioFilesService.getPresignedUrls({ 23 bucketName: DefaultBucketNames.video, 24 expiry: 60, 25 ext: request.ext, 26 }); 27 } 28 29 @Get('documents-presigned-url') 30 getDocumentsPresignedUrl(@Query() request: PresignedUrlsRequest) { 31 return this.minioFilesService.getPresignedUrls({ 32 bucketName: DefaultBucketNames.documents, 33 expiry: 60, 34 ext: request.ext, 35 }); 36 } 37} 38 39process.env.MINIO_SERVER_HOST = 'localhost'; 40process.env.MINIO_SERVER_PORT = '9000'; 41process.env.MINIO_ACCESS_KEY = 'minioadmin'; 42process.env.MINIO_SECRET_KEY = '6EcbcW66JsKvFrY2bZw6QGKjHhefca7Kgppq'; 43process.env.MINIO_USE_SSL = 'false'; 44process.env.MINIO_DEFAULT_USER_ID = 'default'; 45 46@Module({ 47 imports: [MinioModule.forRoot()], 48 controllers: [AppController], 49}) 50export class AppModule {} 51 52async function bootstrap() { 53 const app = await NestFactory.create(AppModule); 54 await app.listen(3000); 55 56 const appController = app.get<AppController>(AppController); 57 console.log(await lastValueFrom(appController.getImagesPresignedUrl({ ext: 'png' }))); 58 /** 59 * output: 60 * { 61 * uploadUrl: '/images/default/images_ac98618c-f2ec-4a2f-a4a8-a4690e8fd543.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240213T071934Z&X-Amz-Expires=60&X-Amz-SignedHeaders=host&X-Amz-Signature=ea5c4246876c0c15a57e7c6cb0035fb3122c4887b052d2138d643f3e88e8a4c3', 62 * downloadUrl: '/images/default/images_ac98618c-f2ec-4a2f-a4a8-a4690e8fd543.png' 63 * } 64 */ 65} 66 67bootstrap();
An example of using Minio, you can see the full example here https://github.com/nestjs-mod/nestjs-mod-contrib/tree/master/apps/example-minio and frontend on Angular here https://github.com/nestjs-mod/nestjs-mod-contrib/tree/master/apps/example-minio-angular.
For work with Minio, you must first connect the Docker Compose module and the Docker Compose module to work with the Minio.
1import { 2 DefaultNestApplicationInitializer, 3 DefaultNestApplicationListener, 4 InfrastructureMarkdownReportGenerator, 5 PACKAGE_JSON_FILE, 6 ProjectUtils, 7 bootstrapNestApplication, 8 createNestModule, 9 isInfrastructureMode, 10} from '@nestjs-mod/common'; 11import { DefaultBucketNames, MinioFilesService, MinioModule, PresignedUrlsRequest } from '@nestjs-mod/minio'; 12import { Controller, Get, Query } from '@nestjs/common'; 13import { join } from 'path'; 14import { lastValueFrom } from 'rxjs'; 15import { userFeatureName } from './app/app.constants'; 16 17import { DOCKER_COMPOSE_FILE, DockerCompose, DockerComposeMinio } from '@nestjs-mod/docker-compose'; 18 19@Controller() 20export class AppController { 21 constructor(private readonly minioFilesService: MinioFilesService) {} 22 23 @Get('images-presigned-url') 24 getImagesPresignedUrl(@Query() request: PresignedUrlsRequest) { 25 return this.minioFilesService.getPresignedUrls({ 26 bucketName: DefaultBucketNames.images, 27 expiry: 60, 28 ext: request.ext, 29 }); 30 } 31 32 @Get('video-presigned-url') 33 getVideoPresignedUrl(@Query() request: PresignedUrlsRequest) { 34 return this.minioFilesService.getPresignedUrls({ 35 bucketName: DefaultBucketNames.video, 36 expiry: 60, 37 ext: request.ext, 38 }); 39 } 40 41 @Get('documents-presigned-url') 42 getDocumentsPresignedUrl(@Query() request: PresignedUrlsRequest) { 43 return this.minioFilesService.getPresignedUrls({ 44 bucketName: DefaultBucketNames.documents, 45 expiry: 60, 46 ext: request.ext, 47 }); 48 } 49} 50 51const { AppModule } = createNestModule({ 52 moduleName: 'AppModule', 53 imports: [MinioModule.forFeature()], 54 controllers: [AppController], 55}); 56 57const rootFolder = join(__dirname, '..', '..', '..'); 58const appFolder = join(rootFolder, 'apps', 'example-minio'); 59 60bootstrapNestApplication({ 61 globalConfigurationOptions: { debug: true }, 62 globalEnvironmentsOptions: { debug: true }, 63 modules: { 64 system: [ 65 ProjectUtils.forRoot({ 66 staticConfiguration: { 67 applicationPackageJsonFile: join(appFolder, PACKAGE_JSON_FILE), 68 packageJsonFile: join(rootFolder, PACKAGE_JSON_FILE), 69 envFile: join(rootFolder, '.env'), 70 }, 71 }), 72 DefaultNestApplicationInitializer.forRoot({ 73 staticConfiguration: { 74 bufferLogs: true, 75 }, 76 }), 77 DefaultNestApplicationListener.forRoot({ 78 staticConfiguration: { 79 // When running in infrastructure mode, the backend server does not start. 80 mode: isInfrastructureMode() ? 'silent' : 'listen', 81 postListen: async ({ app }) => { 82 if (app) { 83 const appController = app.get<AppController>(AppController); 84 console.log(await lastValueFrom(appController.getImagesPresignedUrl({ ext: 'png' }))); 85 /** 86 * output: 87 * { 88 * uploadUrl: '/images/default/images_ac98618c-f2ec-4a2f-a4a8-a4690e8fd543.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240213T071934Z&X-Amz-Expires=60&X-Amz-SignedHeaders=host&X-Amz-Signature=ea5c4246876c0c15a57e7c6cb0035fb3122c4887b052d2138d643f3e88e8a4c3', 89 * downloadUrl: '/images/default/images_ac98618c-f2ec-4a2f-a4a8-a4690e8fd543.png' 90 * } 91 */ 92 } 93 }, 94 }, 95 }), 96 ], 97 core: [MinioModule.forRoot()], 98 feature: [AppModule.forRoot()], 99 infrastructure: [ 100 InfrastructureMarkdownReportGenerator.forRoot({ 101 staticConfiguration: { 102 markdownFile: join(appFolder, 'INFRASTRUCTURE.MD'), 103 skipEmptySettings: true, 104 }, 105 }), 106 DockerCompose.forRoot({ 107 configuration: { 108 dockerComposeFileVersion: '3', 109 dockerComposeFile: join(appFolder, DOCKER_COMPOSE_FILE), 110 }, 111 }), 112 DockerComposeMinio.forRoot({ 113 staticConfiguration: { 114 nginxPort: 1111, 115 nginxFilesFolder: join(appFolder, 'ngnix'), 116 featureName: userFeatureName, 117 }, 118 }), 119 ], 120 }, 121});
New environment variable
1EXAMPLE_MINIO_MINIO_SERVER_HOST=localhost 2EXAMPLE_MINIO_MINIO_SERVER_PORT=9000 3EXAMPLE_MINIO_MINIO_ACCESS_KEY=minioadmin 4EXAMPLE_MINIO_MINIO_SECRET_KEY=6EcbcW66JsKvFrY2bZw6QGKjHhefca7Kgppq 5EXAMPLE_MINIO_MINIO_USE_SSL=false 6EXAMPLE_MINIO_MINIO_DEFAULT_USER_ID=default 7EXAMPLE_MINIO_PORT=3006 8EXAMPLE_MINIO_HOSTNAME=
When launched in the infrastructure documentation generation mode, the module creates an .env
file with a list of all required variables, as well as an example example.env
, where you can enter example variable values.
MinioService
, MinioFilesService
Key | Description | Sources | Constraints | Default | Value |
---|---|---|---|---|---|
minioServerHost | Server host | obj['minioServerHost'] , process.env['MINIO_SERVER_HOST'] | isNotEmpty (minioServerHost should not be empty) | - | - |
minioServerPort | Server port | obj['minioServerPort'] , process.env['MINIO_SERVER_PORT'] | optional | 9000 | 9000 |
minioAccessKey | Access key | obj['minioAccessKey'] , process.env['MINIO_ACCESS_KEY'] | isNotEmpty (minioAccessKey should not be empty) | - | - |
minioSecretKey | Secret key | obj['minioSecretKey'] , process.env['MINIO_SECRET_KEY'] | isNotEmpty (minioSecretKey should not be empty) | - | - |
minioUseSSL | Use SSL | obj['minioUseSSL'] , process.env['MINIO_USE_SSL'] | optional | false | false |
minioDefaultUserId | Default user id | obj['minioDefaultUserId'] , process.env['MINIO_DEFAULT_USER_ID'] | optional | default | default |
Key | Description | Constraints | Default | Value |
---|---|---|---|---|
featureName | Feature name for generate prefix to environments keys | optional | - | - |
region | Region | optional | us-east-1 | - |
transport | Transport | optional | - | - |
sessionToken | Session token | optional | - | - |
partSize | Part size | optional | - | - |
pathStyle | Config options name | optional | true | - |
credentialsProvider | Credentials provider | optional | - | - |
s3AccelerateEndpoint | S3 accelerate endpoint | optional | - | - |
transportAgent | Transport agent | optional | - | - |
buckets | Buckets with policy | optional | {"images":{"policy":{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":["*"]},"Action":["s3:PutObject","s3:AbortMultipartUpload","s3:DeleteObject","s3:GetObject"],"Resource":["arn:aws:s3:::images/*.jpg","arn:aws:s3:::images/*.jpeg","arn:aws:s3:::images/*.png","arn:aws:s3:::images/*.gif"]}],"Conditions":[["content-length-range",5242880]]},"ext":["jpg","jpeg","png","gif"]},"video":{"policy":{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":["*"]},"Action":["s3:PutObject","s3:AbortMultipartUpload","s3:DeleteObject","s3:GetObject"],"Resource":["arn:aws:s3:::video/*.mp4"]}],"Conditions":[["content-length-range",52428800]]},"ext":["mp4"]},"documents":{"policy":{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":["*"]},"Action":["s3:PutObject","s3:AbortMultipartUpload","s3:DeleteObject","s3:GetObject"],"Resource":["arn:aws:s3:::documents/*.doc","arn:aws:s3:::documents/*.docx","arn:aws:s3:::documents/*.xls","arn:aws:s3:::documents/*.md","arn:aws:s3:::documents/*.odt","arn:aws:s3:::documents/*.txt","arn:aws:s3:::documents/*.xml","arn:aws:s3:::documents/*.rtf","arn:aws:s3:::documents/*.csv"]}],"Conditions":[["content-length-range",10485760]]},"ext":["doc","docx","xls","md","odt","txt","xml","rtf","csv"]}} | - |
MIT
No vulnerabilities found.
No security vulnerabilities found.