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
}
}

TA貢獻(xiàn)1921條經(jīng)驗(yàn) 獲得超9個(gè)贊
您可以使用該方法getShareMetadata
fileService.getShareMetadata(shareName,?function?(error,?result,?response)?{
添加回答
舉報(bào)