如何在用于浏览器的azure存储javascript SDK中使用BlockBlobClient.getProperties获取元数据

问题描述 投票:0回答:1

我正在尝试使用azure存储javascript SDK获取特定blob的元数据。这是我的代码:

private returnBlobMetadata(filename: string, container: string) {
    const blobServiceClient = new BlobServiceClient(`${this.sasData.storageUri}?${this.sasData.storageAccessToken}`);
    const containerClient = blobServiceClient.getContainerClient(container);
    const blobClient = containerClient.getBlockBlobClient(filename);
    return from(blobClient.getProperties());
}

当我订阅此函数的输出时,得到响应。但是,我的元数据是空的,尽管门户网站中存在元数据,但其他所有实体也是空的。列出容器中的Blob时,我也可以接收元数据。

这是我的回复:

““>

非常感谢您能给我的帮助,因为我一直在为此努力。

编辑

通过检查标题,我可以看到它存在一个x-ms-meta-filename。
   Accept-Ranges: bytes
    Access-Control-Allow-Origin: *
    Access-Control-Expose-Headers: content-length
    Content-Length: 67961
    Date: Tue, 28 Apr 2020 11:41:08 GMT
    ETag: "0x8D7EB1A5E0E88CF"
    Last-Modified: Tue, 28 Apr 2020 02:17:57 GMT
    Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
    x-ms-access-tier: Hot
    x-ms-access-tier-inferred: true
    x-ms-blob-type: BlockBlob
    x-ms-client-request-id: **id**
    x-ms-creation-time: Tue, 28 Apr 2020 01:50:06 GMT
    x-ms-lease-state: available
    x-ms-lease-status: unlocked
    x-ms-meta-filename: Curriculum Vitae.pdf <-- this is what I want
    x-ms-request-id: 4d87bf9c-901e-0089-5551-1d8136000000
    x-ms-server-encrypted: true
    x-ms-version: 2019-02-02

我正在尝试使用azure存储javascript SDK获取特定blob的元数据。这是我的代码:private returnBlobMetadata(filename:string,container:string){const ...

javascript azure sdk azure-storage azure-storage-blobs
1个回答
0
投票

已解决

© www.soinside.com 2019 - 2024. All rights reserved.