@maioradv/nestjs-core 1.6.3 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -17,8 +17,13 @@ export declare class S3Service {
|
|
|
17
17
|
constructor(config: ConfigService);
|
|
18
18
|
uploadImage(file: Express.Multer.File): Promise<UploadImageResponse>;
|
|
19
19
|
removeFile(fileName: string): Promise<import("@aws-sdk/client-s3").DeleteObjectCommandOutput>;
|
|
20
|
-
listFiles(
|
|
20
|
+
listFiles(opts?: {
|
|
21
|
+
limit?: number;
|
|
22
|
+
folder?: string;
|
|
23
|
+
}): Promise<import("@aws-sdk/client-s3").ListObjectsCommandOutput>;
|
|
21
24
|
removeFiles(keys: string[]): Promise<import("@aws-sdk/client-s3").DeleteObjectsCommandOutput>;
|
|
22
|
-
clearAll(
|
|
25
|
+
clearAll(opts?: {
|
|
26
|
+
folder?: string;
|
|
27
|
+
}): Promise<import("@aws-sdk/client-s3").DeleteObjectsCommandOutput>;
|
|
23
28
|
private randomString;
|
|
24
29
|
}
|
|
@@ -65,11 +65,11 @@ let S3Service = class S3Service {
|
|
|
65
65
|
Key: `${this.sdkConfigs.folder}/${fileName}`,
|
|
66
66
|
}));
|
|
67
67
|
}
|
|
68
|
-
async listFiles(
|
|
68
|
+
async listFiles(opts = {}) {
|
|
69
69
|
return this.client.send(new client_s3_1.ListObjectsCommand({
|
|
70
70
|
Bucket: this.sdkConfigs.bucketName,
|
|
71
|
-
Prefix: this.sdkConfigs.folder,
|
|
72
|
-
MaxKeys: limit
|
|
71
|
+
Prefix: opts.folder ?? this.sdkConfigs.folder,
|
|
72
|
+
MaxKeys: opts.limit
|
|
73
73
|
}));
|
|
74
74
|
}
|
|
75
75
|
async removeFiles(keys) {
|
|
@@ -82,10 +82,10 @@ let S3Service = class S3Service {
|
|
|
82
82
|
}
|
|
83
83
|
}));
|
|
84
84
|
}
|
|
85
|
-
async clearAll() {
|
|
85
|
+
async clearAll(opts = {}) {
|
|
86
86
|
const paginator = (0, client_s3_1.paginateListObjectsV2)({ client: this.client }, {
|
|
87
87
|
Bucket: this.sdkConfigs.bucketName,
|
|
88
|
-
Prefix: this.sdkConfigs.folder,
|
|
88
|
+
Prefix: opts.folder ?? this.sdkConfigs.folder,
|
|
89
89
|
});
|
|
90
90
|
const objectKeys = [];
|
|
91
91
|
for await (const { Contents } of paginator) {
|