如何从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 metadatafile,可以对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']

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...