如何解决如何从Azure文件共享获取文件元数据?
我正在尝试使用npm storage-file-share从Azure文件共享中获取文件共享元数据。
如下所示的代码段,但在文档中找不到元数据的任何地方。
有什么方法可以从azure库中获取元数据,还是必须调用rest api?
#define MAXLINE 8192
int main() {
char cmdline[MAXLINE];
if (fgets(cmdline,MAXLINE,stdin) == NULL) {
// end-of-file or rare input error occurred
exit(0);
}
printf("the string is `%s`",cmdline);
exit(0);
}
解决方法
对于fetching metadata
和file
,可以对directory
使用getProperties方法。这是此方法的定义:
返回所有用户定义的元数据,标准HTTP属性和 文件的系统属性。它不返回 文件。
因此,在您的代码-> for await (const item of dirIter)
内,您需要确定它是file
还是directory
,然后调用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
}
}
,
您可以使用方法getShareMetadata
lst_manyset_failers = list(df_train[lst_numerics].columns.values[ list(null_surrogate_failers) ])
lst_manyset_failers.sort()
lst_manyset_failers
['3Ssn Porch','Bsmt Half Bath','BsmtFin SF 2','Low Qual Fin SF','Misc Val','Pool Area']
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。