简体   繁体   English

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

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

From this document , there is no example to set Blob Service Properties.本文档中没有设置 Blob 服务属性的示例。

Below is my Sample Code:下面是我的示例代码:

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

await blockBlobClient.uploadFile(FILEPATH);

Please advise how I can upload a file with setting contentDisposition and contentType in properties of blockBlob.请告知我如何通过在 blockBlob 的properties中设置contentDispositioncontentType来上传文件。

Please try this way:请尝试这种方式:

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

If there are other questions, please let me know!如果还有其他问题,请告诉我!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用@azure/storage-blob sdk append 一个 blob 文件? (NodeJS) - How do I append a blob file using @azure/storage-blob sdk ? (NodeJS) NodeJS '@azure/storage-blob':如何为现有 blob 设置 blobcontentdisposition 属性 - NodeJS '@azure/storage-blob': How do set blobcontentdisposition property for the existing blobs 如何通过 node.js 中的@azure/storage-blob 在 blob 存储中获取文件的安全 url? - How to get secure url of File in blob storage via @azure/storage-blob in node.js? 将视频文件上传到NODEJS中的AZURE BLOB STORAGE - Uploading Video File to AZURE BLOB STORAGE in NODEJS 如何使用 nodejs 在 azure blob 存储上设置 contenttype - How to set contenttype on azure blob storage with nodejs 将ExcelJS的输出上传到NodeJS中的Azure Blob存储 - Uploading output of ExcelJS to Azure Blob Storage in NodeJS 无法使用 @azure/storage-blob (SDK/NPM) 中的 uploadFile 方法设置内容类型 - Can't set content type from using uploadFile method in @azure/storage-blob (SDK/NPM) Node.js Azure存储Blob服务:getStats不起作用 - Nodejs Azure storage blob service : getStats not working @azure/storage-blob 如何从 Azuree 获取 uploadStream 图像 url 的结果 - @azure/storage-blob how to get result of uploadStream image url from Azuree 如何使用Node设置Azure Blob存储CORS属性? - How to set Azure Blob Storage CORS properties using Node?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM