Add contact, upgrade versions, add docs

This commit is contained in:
2024-10-15 17:29:35 -06:00
parent 2fff8e9887
commit d48040bd58
23 changed files with 2299 additions and 2151 deletions

View File

@@ -2,7 +2,9 @@ import { CACHE_MANAGER } from '@nestjs/cache-manager';
import { Cache } from 'cache-manager';
import { Inject, Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { Client, ItemBucketMetadata, UploadedObjectInfo } from 'minio';
import { Client, ItemBucketMetadata } from 'minio';
import { UploadedObjectInfo } from 'minio/dist/main/internal/type';
import { open, readFileSync } from 'fs';
@Injectable()
export class MinioService {
@@ -30,12 +32,8 @@ export class MinioService {
filePath: string,
metadata?: ItemBucketMetadata,
): Promise<UploadedObjectInfo> {
return await this.client.fPutObject(
bucketName,
objectName,
filePath,
metadata,
);
const file = readFileSync(filePath);
return this.uploadBuffer(bucketName, objectName, file, metadata);
}
public async uploadBuffer(
@@ -44,10 +42,11 @@ export class MinioService {
buffer: Buffer,
metadata?: ItemBucketMetadata,
): Promise<UploadedObjectInfo> {
return await this.client.putObject(
return this.client.putObject(
bucketName,
objectName,
buffer,
buffer.length,
metadata,
);
}