How to set contenttype on azure blob storage with nodejs
According the comments in source code at Github, the option
architecture has changed, to define the contentType
, please try to use following code snippet:
var options = {contentSettings:{contentType:'audio/wav'}}
Any further concern, please feel free to let me know.
It has changed again, according the source code, the upload can expect a BlockBlobUploadOptions, with an optional blobHTTPHeaders object. This gives you the possibility to set http headers to set for the blob when requested. Too bad, none of the sample goes into that much details what to set when uploading blobs.
This worked for me
const blobOptions = { blobHTTPHeaders: { blobContentType: 'text/plain' } };
const uploadBlobResponse = await blockBlobClient.upload(ascii, ascii.length, blobOptions);