feat: servir arquivos do MinIO via API interna

This commit is contained in:
Erik
2025-11-27 15:20:30 -03:00
parent 30ddb5392e
commit ca3eac5e1e
5 changed files with 69 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
import { S3Client, HeadBucketCommand, CreateBucketCommand, PutBucketPolicyCommand, PutObjectCommand, DeleteObjectCommand } from '@aws-sdk/client-s3';
import { S3Client, HeadBucketCommand, CreateBucketCommand, PutBucketPolicyCommand, PutObjectCommand, DeleteObjectCommand, GetObjectCommand } from '@aws-sdk/client-s3';
const endpointHost = process.env.MINIO_ENDPOINT || 'localhost';
const port = Number.parseInt(process.env.MINIO_PORT || '9000', 10);
@@ -77,6 +77,10 @@ export const minioClient = {
}));
},
async getObject(bucket: string, key: string) {
return s3Client.send(new GetObjectCommand({ Bucket: bucket, Key: key }));
},
async removeObject(bucket: string, key: string) {
await s3Client.send(new DeleteObjectCommand({ Bucket: bucket, Key: key }));
},