如何通过 JavaScript SDK 在 azure 中读取 blob 的元数据?
当我迭代从指定容器返回的 blob 时,我看到一个元数据属性:
但它是未定义的,即使肯定有与 blob 关联的元数据:
我还需要做些什么来填充元数据吗?
import { BlobServiceClient, SharedKeyCredential } from "@azure/storage-blob";
const account = "<redacted>";
const accountKey = "<redacted>";
const sharedKeyCredential = new SharedKeyCredential(account, accountKey);
const blobServiceClient = new BlobServiceClient(`https://${account}.blob.core.windows.net`, sharedKeyCredential);
const containerClient = blobServiceClient.getContainerClient(podcastName);
const blobs = await containerClient.listBlobsFlat({ include: ["metadata"] });
for await (const blob of blobs) {
console.log(blob.name);
//blob.metadata is undefined
}
// package.json relevant dependencies
"dependencies": {
"@azure/storage-blob": "^12.0.0-preview.2
}