第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何從 Azure 文件共享獲取文件元數(shù)據(jù)?

如何從 Azure 文件共享獲取文件元數(shù)據(jù)?

森林海 2023-02-24 10:35:36
我正在嘗試使用 npm storage-file-share從 Azure 文件共享獲取文件共享元數(shù)據(jù)。代碼片段如下,但沒(méi)有在文檔中找到任何獲取元數(shù)據(jù)的地方。有沒(méi)有辦法從 azure 庫(kù)中獲取元數(shù)據(jù)或者必須調(diào)用rest api?const serviceClient = new ShareServiceClient(      `https://${storageAccountName}.file.core.windows.net`,      credential    );    const directoryClient  = serviceClient.getShareClient(shareName).getDirectoryClient(directoryPath);    const dirIter = directoryClient.listFilesAndDirectories();    const list = [];    for await (const item of dirIter) {        list.push({name: item.name, metadata????}); // Need item metadata     }
查看完整描述

2 回答

?
繁星淼淼

TA貢獻(xiàn)1775條經(jīng)驗(yàn) 獲得超11個(gè)贊

您可以將getProperties方法用于fetching metadata和file。directory下面是這個(gè)方法的定義:


返回文件的所有用戶定義元數(shù)據(jù)、標(biāo)準(zhǔn) HTTP 屬性和系統(tǒng)屬性。它不返回文件的內(nèi)容。


所以在你的代碼 -> 里面for await (const item of dirIter),你需要判斷是不是fileor directory,然后調(diào)用getProperties()方法。示例代碼如下所示:


for await (const item of dirIter) {

      if (item.kind === "directory") {

        

        const mydirectory = directoryClient.getDirectoryClient(item.name);

        var diretory_properties = await mydirectory.getProperties();


        //for test, you can print out the metadata

        console.log(diretory_properties.metadata);


        //here, you can write code to add the metadata in your list


      } else {

        

        const myfile=directoryClient.getFileClient(item.name);

        var the_properties = await myfile.getProperties();


        //for test, you can print out the metadata

        console.log(the_properties.metadata)


       //here, you can write code to add the metadata in your list


      }

    }


查看完整回答
反對(duì) 回復(fù) 2023-02-24
?
郎朗坤

TA貢獻(xiàn)1921條經(jīng)驗(yàn) 獲得超9個(gè)贊

您可以使用該方法getShareMetadata

fileService.getShareMetadata(shareName,?function?(error,?result,?response)?{


查看完整回答
反對(duì) 回復(fù) 2023-02-24
  • 2 回答
  • 0 關(guān)注
  • 157 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)