Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8767993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:57:29+00:00 2026-06-13T16:57:29+00:00

All, I am trying to find a way to chunk read blob from windows

  • 0

All, I am trying to find a way to chunk read blob from windows azure .now I had some problem with it , the total size of chunk read is not equal to the total size of the blob. My test blob size is 154805720 bytes, and every chunk reading size is 10*1024*1024. I found the last buffer of chunk read is not the supposed size 8005080 bytes .It is always 4M.
BTW, I have downloaded this blob to local by cloudbrerry storage explorer. it is same size with the original file I uploaded before. so ,I am sure the blob original size is ok ,that means 154805720 bytes.
Here is my code .please help review it .

        private static CloudBlobClient CreateBlobClient(StorageAccount account)
        {
            CloudBlobClient blobClient = null;
            CloudStorageAccount oStorageAccount = CreateStorageAccount(account);
            blobClient = oStorageAccount.CreateCloudBlobClient();
            blobClient.Timeout = new TimeSpan(2, 0, 0);
            blobClient.WriteBlockSizeInBytes = 4 * 1024 * 1024;
            blobClient.RetryPolicy = RetryPolicies.Retry(20, TimeSpan.Zero);

            return blobClient;
        }



        public static byte[] DownloadChunkFromBlob(StorageAccount account, string sContainerName, String sBlobName, int blobOffset, int bufferSize)
        {
            CloudBlobClient blobClient = CreateBlobClient(account);

            CloudBlobContainer container = blobClient.GetContainerReference(sContainerName);
            bool b = container.CreateIfNotExist();
            CloudBlob blob = container.GetBlobReference(sBlobName);

            using (var blobStream = blob.OpenRead())
            {
                var buffer = new byte[bufferSize];
                blobStream.Seek(blobOffset, SeekOrigin.Begin);
                int numBytesRead = blobStream.Read(buffer, 0, bufferSize);

                if (numBytesRead != bufferSize)
                {
                    var trimmedBuffer = new byte[numBytesRead];
                    Array.Copy(buffer, trimmedBuffer, numBytesRead);
                    return trimmedBuffer;
                }
                return buffer;
            }
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:57:31+00:00Added an answer on June 13, 2026 at 4:57 pm

    The answer is OpenRead() can only read up to 4 MB in a single go. When I set the chunk read size is 4MB . Everything is Fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to find a way to automatically download all links from a web
All, I am trying to find a way to download a large blob file
I'm trying to find a way to delay all code that takes place after
I'm trying to find a way to disable all dates that are not at
So I'm trying to find a way to get a collection of all versions
I am trying to find a universal way to expand most if not all
I am trying to find simple, elegant way to get all the pertinent name,value
I'm trying to find a way to delete all characters in the first word
I'm trying to find a way to append a list to all lists within
I'm trying to find a way to retrieve my own private playlists from YouTube,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.