mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 15:00:26 +00:00
[@types/minio] Added metadata functionality (#26906)
* Added metadata functionality * No need for seperate interface. Changed metadata values to any * Added interface for item metadata * bump version to 6.0
This commit is contained in:
committed by
Mohamed Hegazy
parent
028b6d91ab
commit
919aa8ed30
Vendored
+9
-5
@@ -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<string>): void;
|
||||
putObject(bucketName: string, objectName: string, stream: Stream|Buffer|string, size: number, callback: ResultCallback<string>): void;
|
||||
putObject(bucketName: string, objectName: string, stream: Stream|Buffer|string, size: number, cotentType: string, callback: ResultCallback<string>): void;
|
||||
putObject(bucketName: string, objectName: string, stream: Stream|Buffer|string, size?: number, cotentType?: string): Promise<string>;
|
||||
putObject(bucketName: string, objectName: string, stream: Stream|Buffer|string, size: number, metaData: ItemBucketMetadata, callback: ResultCallback<string>): void;
|
||||
putObject(bucketName: string, objectName: string, stream: Stream|Buffer|string, size?: number, metaData?: ItemBucketMetadata): Promise<string>;
|
||||
|
||||
fPutObject(bucketName: string, objectName: string, filePath: string, contentType: string, callback: ResultCallback<string>): void;
|
||||
fPutObject(bucketName: string, objectName: string, filePath: string, contentType: string): Promise<string>;
|
||||
fPutObject(bucketName: string, objectName: string, filePath: string, metaData: ItemBucketMetadata, callback: ResultCallback<string>): void;
|
||||
fPutObject(bucketName: string, objectName: string, filePath: string, metaData: ItemBucketMetadata): Promise<string>;
|
||||
|
||||
copyObject(bucketName: string, objectName: string, sourceObject: string, conditions: CopyConditions, callback: ResultCallback<BucketItemCopy>): void;
|
||||
copyObject(bucketName: string, objectName: string, sourceObject: string, conditions: CopyConditions): Promise<BucketItemCopy>;
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user