【问题标题】:File Upload into Azure Data Lake Storage文件上传到 Azure Data Lake Storage
【发布时间】:2020-03-18 15:17:55
【问题描述】:

我是 Node 新手,需要编写一个 Node js 应用程序来将一堆文件上传到 Azure Data Lake 存储中,文件大小以 MB 为单位可以进入 GB,最好的方法是什么?节点包可以提供相同的帮助吗?任何指针都非常感谢。

【问题讨论】:

    标签: node.js azure


    【解决方案1】:

    您可以使用 @azure/storage-file-datalake 包与 Azure Data Lake Storage 进行交互。你可以在这里找到一些与之交互的示例:https://docs.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-directory-file-acl-javascript

    same link上传文件的代码示例:

    async function UploadFile(fileSystemClient) {
    
      const fs = require('fs') 
    
      var content = "";
    
      fs.readFile('mytestfile.txt', (err, data) => { 
          if (err) throw err; 
    
          content = data.toString();
    
      }) 
    
      const fileClient = fileSystemClient.getFileClient("my-directory/uploaded-file.txt");
      await fileClient.create();
      await fileClient.append(content, 0, content.length);
      await fileClient.flush(content.length);
    
    }
    

    【讨论】:

      猜你喜欢
      • 2019-11-13
      • 1970-01-01
      • 2019-07-10
      • 2020-11-22
      • 1970-01-01
      • 2023-03-26
      • 1970-01-01
      • 2017-10-03
      • 2019-06-05
      相关资源
      最近更新 更多