【发布时间】:2021-10-08 18:22:00
【问题描述】:
我有一个 NodeJS 后端,它使用 Microsoft 的官方 blob 存储库 (@azure/storage-blob) 来管理我的 Blob 存储:
https://www.npmjs.com/package/@azure/storage-blob
必须将 blob 从一个文件夹移动到另一个文件夹。 不幸的是,我找不到任何文档。
到目前为止我所做的是:
const { BlobServiceClient } = require("@azure/storage-blob");
const blobServiceClient = BlobServiceClient.fromConnectionString(process.env.storageconnection);
const containerClient = blobServiceClient.getContainerClient('import');
const blobClient = containerClient.getBlobClient('toImport/' + req.body.file);
const downloadBlockBlobResponse = await blobClient.download();
... do some stuff with the value of the files
就像您在代码中看到的那样,我从文件夹“toImport”中读取了一个文件。之后,我想将文件移动到另一个文件夹“完成”。那可能吗?也许我需要创建文件的副本并删除旧的?
【问题讨论】:
-
Maybe I need to create a copy of the file and delete the old one?- 这正是您需要做的。您无需下载和上传。 -
但我该怎么做。我找不到那个命令。 getBlobClient() 有什么方法吗?
标签: javascript node.js azure azure-blob-storage