Azure-sdk-for-net: Storage: Add progress handling for upload/download

Created on 29 Oct 2019  路  7Comments  路  Source: Azure/azure-sdk-for-net

BlobBaseClient.StagedDownloadAsync and BlobClient.StagedUploadAsync have commented out progress handlers.

Client Service Attention Storage customer-reported feature-request

Most helpful comment

being able to pass an IProgress<> to .DownloadToAsync(), just as we can with .UploadAsync(), would be very helpful.

Is this currently planned? If yes, is there a milestone/timeline? I'm asking because I need to support an API that expects to monitor the progress of downloads and I'm wondering whether it makes sense to work around the missing progress support by implementing a wrapper around it myself - for which I probably have to turn off parallelism which is not nice - or whether the support will come to the Azure.Storage.Blobs in time for my own deadline.

Thanks,
MR

All 7 comments

Adding customer-reported tag here since I closed #9216 as a duplicate.

Is this one fixed?

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.

@Petermarcu, IIRC we have progress reporting for all upload APIs now, but not downloads.

When can we add progress reporting for BlobBaseClient.DownloadToAsync()?
We plan to use this API in Blob Download cmdlet in PSH.

being able to pass an IProgress<> to .DownloadToAsync(), just as we can with .UploadAsync(), would be very helpful.

Is this currently planned? If yes, is there a milestone/timeline? I'm asking because I need to support an API that expects to monitor the progress of downloads and I'm wondering whether it makes sense to work around the missing progress support by implementing a wrapper around it myself - for which I probably have to turn off parallelism which is not nice - or whether the support will come to the Azure.Storage.Blobs in time for my own deadline.

Thanks,
MR

This might help .NET Developers:

public static Task Download(this BlobClient blobClient, string localPath, IProgress<long> progressPercentage)
{
    Response<BlobProperties> blobProperties = blobClient.GetProperties();
    long blobContentLength = blobProperties.Value.ContentLength;

    using (FileStream stream = File.Create(localPath))
    {
        Task<Response> downloadTask = blobClient.DownloadToAsync(stream);

        //Read how many bytes on stream.
        while (stream.Length < blobContentLength)
        {
            progressPercentage.Report(stream.Length * 100 / blobContentLength);
        }

        return downloadTask;
    }
}

In my code, I export the percentage (x%) and not the downloaded bytes ( you can see I calculate stream.Length * 100 / blobContentLength ). Hope it helps someone

Was this page helpful?
0 / 5 - 0 ratings