Malik Kashmiri
Malik Kashmiri

Reputation: 5851

Azure blob metadata in angular 6 typesrcipt

I am trying to upload blob in azure blob storage with some metadata. I don't know how to set metadata and send with the blob. Right how I am doing this:

this.blobService.createBlockBlobFromBrowserFile(container, path, file, (error, result, response) => {
});

Upvotes: 2

Views: 1266

Answers (2)

Thomas
Thomas

Reputation: 29491

Looking at the documentation:

You can add options while creating a blob:

var metadata = {
    category: 'blabla',
    type: 'test'
}

blobService.createBlockBlobFromBrowserFile(
      container
    , path
    , file,
    , options: {
        metadata: metadata
      }
    , (error, result, response) => {
});

Upvotes: 4

AFAIK, there are only two ways to set the blob metadata, using the rest api in C#, ex:

[Microsoft.WindowsAzure.Storage.DoesServiceRequest]
public virtual void SetMetadata (Microsoft.WindowsAzure.Storage.AccessCondition accessCondition = null, Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions options = null, Microsoft.WindowsAzure.Storage.OperationContext operationContext = null);

More can be found here

Or via URI:

https://myaccount.blob.core.windows.net/mycontainer/myblob?comp=metadata

More can be found here

Upvotes: 0

Related Questions