NodeJS '@azure/storage-blob':上传文件时如何设置 Blob 服务属性

NodeJS '@azure/storage-blob': How do set Blob Service Properties when uploading a file

this document 开始,没有设置 Blob 服务属性的示例。

下面是我的示例代码:

let containerClient = blobServiceClient.getContainerClient(CONTAINERNAME),
    blockBlobClient = containerClient.getBlockBlobClient(BLOBNAME);

await blockBlobClient.uploadFile(FILEPATH);

请告诉我如何在 blockBlob 的 properties 中设置 contentDispositioncontentType 上传文件。

请尝试这种方式:

    const blobOptions = { blobHTTPHeaders: { blobContentType: 'image/jpeg', blobContentDisposition: "attachment; filename=package.jpg" } };
    const uploadBlobResponse =await blockBlobClient.uploadFile(filePath,blobOptions);

如果还有其他问题,请告诉我!