Search code examples
node.jsazure-storageazure-blob-storage

Nodejs/Azure - How to set url metadata in startCopyBlob


I am saving an image from a url to a blob using startCopyBlob.

I see from the documentation that I can set metadata too, however, I am struggling here when adding a url to the metadata

https://azure.github.io/azure-storage-node/BlobService.html#startCopyBlob__anchor

Below is my current code

      blobService.startCopyBlob(url, container, filename,{
            metadata: {
                'url': url,
            }}, function(error) {
    if (!error) {
        context.log('Message inserted:', text);
    }
    else {
        context.log('All done'); 
        context.done()
    }
});

All the metadata returns is 'url': https


Solution

  • Your code is fine.

    You could either use getBlobMetadata() function or Azure Storage Explorer to check the metadata after saving blob.

    enter image description here