New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As of v12, what is the recommended API to use for downloading Block Blob files? #22022
Comments
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage. Issue DetailsQuery/Question There seems to be several available "download" APIs on the BlobClient, but their docs are somewhat vague or ambiguous and the MS Docs don't seem to clarify any further:
When I looked at the decompiled source for I have production code that uses the Additionally, if trying to do some other operation that is not downloading to a browser client via a REST API, for example, if you're unzipping a blob file and the extracted files are also going into blob storage, would one be better not downloading but instead opening it via I posted similar question on Stack Overflow and was encouraged to raise this as a question/issue here: Environment:
|
Thanks for reaching out @tafs7 (Thiago). I do not think you should be worried that the API will be removed. We periodically move older APIs out if we have better overloads, but we have tests in place to make sure that we never regress even though we marked the API as editorbrowsable false. |
@tafs7 The The difference between |
@tafs7 I went through samples in this repo and couldn't find any usage of hidden API. Could you please share where did you see it? |
@kasobol-msft Thanks for the info. So to clarify, for net new code, we should look to use:
Did I get that right? If so, it might be worth updating the XML docs on these different methods so it's clear what they do and when they should be used. Regarding the "hidden" API, what I meant is that the You can see it here:
|
That sounds right. The The hidden API is a part of binary to assure backwards compatibility - i.e. users bumping just version number won't see a difference but new users or users who modify code will get prompted to seek new alternative. We used that strategy instead of marking it as obsolete as often users configure builds in such a way that using obsolete api makes it fail. |
@kasobol-msft, that makes sense. it just seemed confusing to see that the build worked for existing code using Thanks again! |
I just spent quite a while working though the blob APIs and options here to stream blobs through Azure Front Door (via ASP.NET Core) which requires range-request support. I wrote up what I think is the best solution at https://ticehurst.com/2022/01/30/blob-streaming.html (final code at the end of the article). This did take way more research and experimenting than I expected, so if anyone can give it a quick read for any errors or misunderstandings I'd appreciate it. Thanks. |
Query/Question
What is THE way someone should be downloading files from Azure Blob Storage (block blobs) using the .NET SDK as of v12.9, in an asynchronous fashion, if the goal is to "stream" it down thru, for example, an ASP.NET controller action (REST endpoint) to a client like a browser, etc. (NOT save to a local file on server)?
There seems to be several available "download" APIs on the BlobClient, but their docs are somewhat vague or ambiguous and the MS Docs don't seem to clarify any further:
DownloadAsync()
- marked as not browsable, but de facto way, based on all samples/blogsDownloadStreamingAsync()
DownloadContentAsync()
DownloadToAsync()
OpenReadAsync()
When I looked at the decompiled source for
BlobBaseClient.DownloadAsync()
method, I see that it is decorated with[EditorBrowsable(EditorBrowsableState.Never)]
, implying that this API might slowly be on its way out, but without breaking existing code or marking as Obsolete?I have production code that uses the
BlobClient.DownloadAsync()
method to download a file from Azure Blob Storage using the Azure.Storage.Blobs nuget package v12.8, and it seems to be working just fine. However, I just upgraded the nuget package and was about to write some new code to deal with extracting zip files stored in Azure Blob...but noticed the above mentioned changes in the latest APIs of the Storage SDK.Additionally, if trying to do some other operation that is not downloading to a browser client via a REST API, for example, if you're unzipping a blob file and the extracted files are also going into blob storage, would one be better not downloading but instead opening it via
OpenReadAsync()
?I posted similar question on Stack Overflow and was encouraged to raise this as a question/issue here:
https://stackoverflow.com/questions/68070143/azure-blob-storage-sdk-v12-blobclient-downloadasync-gone
Environment:
Azure.Storage.Blobs
12.9.0
The text was updated successfully, but these errors were encountered: