使用@ azure / storage-blob获取元数据内容 [英] Using @azure/storage-blob to get content with metadata

查看:142
本文介绍了使用@ azure / storage-blob获取元数据内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次尝试使用Electron,而我正在尝试获取Azure存储容器的内容。 包括 "@ azure / storage-blob":" ^ 10.3.0",这适用:


const {

   堕胎者,b
    BlockBlobURL,

    ContainerURL,    

   型号,

    ServiceURL,

    SharedKeyCredential,

    StorageURL,

    uploadStreamToBlockBlob,

    uploadFileToBlockBlob

} = require('@ azure / storage-blob');


 的响应=等待containerURL.listBlobFlatSegment(中止器); 它返回斑点但没有元数据


我发现有人试图也得到使用元数据的一个例子。:


           响应=等待containerURL.listBlobFlatSegment(中止器,

        未定义,

   &NBSP ;     {

          包括:[    &NBSP ;       

             模型.ListBlobsIncludeItem.Metadata,

              Models.ListBlobsIncludeItem.Uncommittedblobs

          ]

        });


但这些枚举似乎不存在 - 或者我没有包含正确的对象。 任何人都可以帮忙吗?






解决方案

@ DeannaD123
对延迟表示歉意!
我们觉得这段代码可能已经过时了。由于"include"属性的选项值,请参阅最新的API文档。尝试下面提到代码:


<预类= "prettyprint">响应=等待containerURL.listBlobFlatSegment(Aborter.none,
未定义,
{
包括:[
"元数据",//候选值可以在API doc中找到,这里是https://docs.microsoft.com/en-us/javascript/api/%40azure/storage -blob / listblobsincludeitem?view = azure-node-preview
"uncommittedblobs"
]
});


原因是什么过时的:JSv10 GA发布期间由autorest引入的更改。您需要提供所需的原始常量字符串。 (虽然像Visual Studio Code
这样的IDE应该能够提供智能提示)。


尝试手动如果您需要转到模型定义页面,请搜索其他模型的链接。对此有任何更新?



https://docs.microsoft.com/en-us/javascript/api/%40azure/storage-blob/containerurl?view=azure-node-preview#listblobflatsegment -aborter - string - icontainerlistblobssegmentoptions-







如果上述情况有所帮助,或者您需要有关此问题的进一步帮助,请告诉我们。


------------------------------------- -------------------------------------------------- ---


点击帮助您的帖子上的"标记为答案",这对其他社区成员有益。



My first attempt at Electron and I'm trying to get the contents of an Azure storage container.  Including "@azure/storage-blob": "^10.3.0", and this works:

const {
    Aborter,
    BlockBlobURL,
    ContainerURL,    
    Models,
    ServiceURL,
    SharedKeyCredential,
    StorageURL,
    uploadStreamToBlockBlob,
    uploadFileToBlockBlob
} = require('@azure/storage-blob');

  response = await containerURL.listBlobFlatSegment(aborter); which returns the blobs but no metadata.

I found an example of someone trying to also get the metadata using:

            response = await containerURL.listBlobFlatSegment(aborter,
                undefined,
                {
                    include: [                      
                         Models.ListBlobsIncludeItem.Metadata,
                         Models.ListBlobsIncludeItem.Uncommittedblobs
                    ]
                });

But those enumerations don't seem to exist - or I'm not including the correct objects.  Can anyone help with this?

解决方案

@DeannaD123 Apologies for the delay! We feel like that code may be outdated. Please refer to the latest API document, because of the option values for "include" property. Try the below mentioned code:

response = await containerURL.listBlobFlatSegment(Aborter.none,
                undefined,
                {
                    include: [                      
                         "metadata", // Candidate values can be found in API doc here 
https://docs.microsoft.com/en-us/javascript/api/%40azure/storage-blob/listblobsincludeitem?view=azure-node-preview "uncommittedblobs" ] });

Reason why it’s outdated: Changes introduced by autorest during JSv10 GA release. You need to provide required raw constant strings. (Although IDEs like Visual Studio Code should able to provide intelligence tips).

Try to manually search links of another model if you need to go-to model definition page. Any updates for this?

https://docs.microsoft.com/en-us/javascript/api/%40azure/storage-blob/containerurl?view=azure-node-preview#listblobflatsegment-aborter--string--icontainerlistblobssegmentoptions-



Kindly let us know if the above helps or you need further assistance on this issue.

------------------------------------------------------------------------------------------

Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.


这篇关于使用@ azure / storage-blob获取元数据内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆