feat: servir arquivos do MinIO via API interna
This commit is contained in:
@@ -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 }));
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user