I need to read blob data quickly. However it seems that FetchAttributes() and OpenRead() methods each do an access to storage. My blobs are really small, so I wish I could read everything in a single access. Is that possible?
The only attribute I'm interested is ETag. I want it to do efficient and conflict-aware updates and deletes to blob contents.
To retrieve metadata, call the GetProperties or GetPropertiesAsync method on your blob or container to populate the Metadata collection, then read the values, as shown in the example below. The GetProperties methods retrieve blob properties and metadata in a single call.
Objects in Blob storage can be accessed from anywhere in the world via HTTP or HTTPS. Users or client applications can access blobs via URLs, the Azure Storage REST API, Azure PowerShell, Azure CLI, or an Azure Storage client library. The storage client libraries are available for multiple languages, including .
According to MSDN you're stuck with a 2 step process:
"Retrieving property and metadata values for a resource is a two-step process. Before you can read these values, you must explicitly fetch them on your CloudBlobContainer, CloudBlockBlob, or CloudPageBlob objects. To fetch properties and metadata synchronously, call FetchAttributes on the container or blob; to fetch them asynchronously, call BeginFetchAttributes and EndFetchAttributes."
Assuming you know the type of your blob and you want to download all properties, metadata, and the contents of the blob, you can directly call DownloadToStream.
DownloadToStream internally makes a Get Blob request, which returns blob's properties and metadata.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With