Add proxy with file rewrite

This commit is contained in:
2024-06-26 16:51:03 -06:00
parent e0f7c29244
commit c25a5230d9
3 changed files with 199 additions and 100 deletions

View File

@@ -91,7 +91,11 @@ export class MinioService {
prefix?: string,
recursive: boolean = false,
): Promise<string[]> {
const objectStream = await this.client.listObjectsV2(bucketName, prefix, recursive);
const objectStream = await this.client.listObjectsV2(
bucketName,
prefix,
recursive,
);
const objects = await new Promise<ItemBucketMetadata[]>(
(resolve, reject) => {
const objects: ItemBucketMetadata[] = [];
@@ -128,4 +132,16 @@ export class MinioService {
): Promise<string> {
return await this.client.presignedGetObject(bucketName, objectName, expiry);
}
public async objectExists(
bucketName: string,
objectName: string,
): Promise<boolean> {
try {
await this.client.statObject(bucketName, objectName);
return true;
} catch (e) {
return false;
}
}
}