From 54a1ca25378c7ce5550a66252de849a4cf9a3612 Mon Sep 17 00:00:00 2001 From: Florent FAYOLLE Date: Sat, 15 Jul 2023 11:00:53 +0200 Subject: [PATCH] Introduce S3ListObject and use it (#1106) --- src/internal/type.ts | 12 ++++++++++++ src/minio.d.ts | 11 +++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/internal/type.ts b/src/internal/type.ts index cfe82d52..0b585588 100644 --- a/src/internal/type.ts +++ b/src/internal/type.ts @@ -105,6 +105,18 @@ export type BucketItemWithMetadata = BucketItem & { metadata?: ItemBucketMetadata | ItemBucketMetadataList } +export type S3ListObject = + | { prefix: string; size: number } + | { name: string; size: number } // sometime api return this, not sure if it's valid + | { + name: string + lastModified: Date + etag: string + size: number + isDeleteMarker?: boolean + isLatest?: boolean + } + export type StatObjectOpts = { versionId?: string } diff --git a/src/minio.d.ts b/src/minio.d.ts index 43633ca0..8e2aad0f 100644 --- a/src/minio.d.ts +++ b/src/minio.d.ts @@ -48,6 +48,7 @@ import type { RETENTION_MODES, RETENTION_VALIDITY_UNITS, RetentionOptions, + S3ListObject, SelectOptions, SourceObjectStats, StatObjectOpts, @@ -100,6 +101,7 @@ export type { RETENTION_MODES, RETENTION_VALIDITY_UNITS, RetentionOptions, + S3ListObject, SelectOptions, SourceObjectStats, StatObjectOpts, @@ -162,9 +164,14 @@ export class Client extends TypedClient { bucketExists(bucketName: string, callback: ResultCallback): void bucketExists(bucketName: string): Promise - listObjects(bucketName: string, prefix?: string, recursive?: boolean): BucketStream + listObjects(bucketName: string, prefix?: string, recursive?: boolean): BucketStream - listObjectsV2(bucketName: string, prefix?: string, recursive?: boolean, startAfter?: string): BucketStream + listObjectsV2( + bucketName: string, + prefix?: string, + recursive?: boolean, + startAfter?: string, + ): BucketStream listIncompleteUploads( bucketName: string,