我使用Azure函数与节点js创建一个zip文件(abc.zip)与函数应用程序临时文件夹中的一些文件,下一步我需要在Azure blob存储中上传zip文件。问题是blob存储路径必须类似于/xyz/pqr/ghk。如何实现这一点?
如@GauravMantri所示,尝试以下方法:
const {
BlobServiceClient
} = require("@azure/storage-blob");
const connectionString = ''
const container = ''
const destBlobName = 'test.zip'
const blob = 'xyz/pqr/ghk/' + destBlobName
const zipFilePath = "<some function temp path>/<filename>.zip"
const blobClient = BlobServiceClient.fromConnectionString(connectionString).getContainerClient(container).getBlockBlobClient(blob)
blobClient.uploadFile(zipFilePath)
如果您还有任何问题,请告诉我:)