Skip to content

Commit

Permalink
feat(bos): 支持getObjectMeta (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
otakustay committed Sep 20, 2022
1 parent 00f64b4 commit 36408a0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/bos/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ export class BosBucketClient {
return this.withObject(key).get();
}

async getObjectMeta(key: string) {
return this.withObject(key).getMeta();
}

async getObjectAsBlob(key: string) {
return this.withObject(key).getAsBlob();
}
Expand Down
4 changes: 4 additions & 0 deletions src/bos/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export class BosClient {
return this.withObject(bucketName, key).get();
}

async getObjectMeta(bucketName: string, key: string) {
return this.withObject(bucketName, key).getMeta();
}

async getObjectAsBlob(bucketName: string, key: string) {
return this.withObject(bucketName, key).getAsBlob();
}
Expand Down
5 changes: 5 additions & 0 deletions src/bos/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export class BosObjectClient {
return response;
}

async getMeta() {
const response = await this.http.noContent('HEAD', `/${this.objectKey}`);
return response;
}

async getAsBlob() {
const response = await this.http.blob('GET', `/${this.objectKey}`);
return response;
Expand Down

0 comments on commit 36408a0

Please sign in to comment.