diff --git a/types/minio/index.d.ts b/types/minio/index.d.ts index ae5c390839..53ca4fa6cd 100644 --- a/types/minio/index.d.ts +++ b/types/minio/index.d.ts @@ -47,9 +47,9 @@ export interface BucketItem { export interface BucketItemStat { size: number; - contentType: string; etag: string; lastModified: Date; + metaData: ItemBucketMetadata; } export interface IncompleteUploadedBucketItem { @@ -69,6 +69,10 @@ export interface PostPolicyResult { }; } +export interface ItemBucketMetadata { + [key: string]: any; +} + // No need to export this. But without it - linter error. export class TargetConfig { setId(id: any): void; @@ -113,11 +117,11 @@ export class Client { putObject(bucketName: string, objectName: string, stream: Stream|Buffer|string, callback: ResultCallback): void; putObject(bucketName: string, objectName: string, stream: Stream|Buffer|string, size: number, callback: ResultCallback): void; - putObject(bucketName: string, objectName: string, stream: Stream|Buffer|string, size: number, cotentType: string, callback: ResultCallback): void; - putObject(bucketName: string, objectName: string, stream: Stream|Buffer|string, size?: number, cotentType?: string): Promise; + putObject(bucketName: string, objectName: string, stream: Stream|Buffer|string, size: number, metaData: ItemBucketMetadata, callback: ResultCallback): void; + putObject(bucketName: string, objectName: string, stream: Stream|Buffer|string, size?: number, metaData?: ItemBucketMetadata): Promise; - fPutObject(bucketName: string, objectName: string, filePath: string, contentType: string, callback: ResultCallback): void; - fPutObject(bucketName: string, objectName: string, filePath: string, contentType: string): Promise; + fPutObject(bucketName: string, objectName: string, filePath: string, metaData: ItemBucketMetadata, callback: ResultCallback): void; + fPutObject(bucketName: string, objectName: string, filePath: string, metaData: ItemBucketMetadata): Promise; copyObject(bucketName: string, objectName: string, sourceObject: string, conditions: CopyConditions, callback: ResultCallback): void; copyObject(bucketName: string, objectName: string, sourceObject: string, conditions: CopyConditions): Promise; diff --git a/types/minio/minio-tests.ts b/types/minio/minio-tests.ts index 2da249e87d..46d83201f7 100644 --- a/types/minio/minio-tests.ts +++ b/types/minio/minio-tests.ts @@ -44,15 +44,21 @@ minio.getPartialObject('testBucket', 'hello.jpg', 10, 20); minio.fGetObject('testBucket', 'hello.jpg', 'file/path', (error: Error|null) => { console.log(error); }); minio.fGetObject('testBucket', 'hello.jpg', 'file/path'); +const metaData = { + 'Content-Type': 'text/html', + 'Content-Language': 123, + 'X-Amz-Meta-Testing': 1234, + example: 5678 +}; minio.putObject('testBucket', 'hello.jpg', new Stream(), (error: Error|null, etag: string) => { console.log(error, etag); }); minio.putObject('testBucket', 'hello.jpg', new Buffer('string'), 100, (error: Error|null, etag: string) => { console.log(error, etag); }); -minio.putObject('testBucket', 'hello.txt', 'hello.txt content', 100, 'text/plain', (error: Error|null, etag: string) => { console.log(error, etag); }); +minio.putObject('testBucket', 'hello.txt', 'hello.txt content', 100, metaData, (error: Error|null, etag: string) => { console.log(error, etag); }); minio.putObject('testBucket', 'hello.jpg', new Stream()); minio.putObject('testBucket', 'hello.jpg', new Buffer('string'), 100); -minio.putObject('testBucket', 'hello.txt', 'hello.txt content', 100, 'text/plain'); +minio.putObject('testBucket', 'hello.txt', 'hello.txt content', 100, metaData); -minio.fPutObject('testBucket', 'hello.jpg', 'file/path', 'image/jpg', (error: Error|null, etag: string) => { console.log(error, etag); }); -minio.fPutObject('testBucket', 'hello.jpg', 'file/path', 'image/jpg'); +minio.fPutObject('testBucket', 'hello.jpg', 'file/path', metaData, (error: Error|null, etag: string) => { console.log(error, etag); }); +minio.fPutObject('testBucket', 'hello.jpg', 'file/path', metaData); const conditions = new Minio.CopyConditions(); conditions.setMatchETag('bd891862ea3e22c93ed53a098218791d');