1
votes

What is the best way and the best practice to download large BLOBs from the Azure storage?

  • I want to use Shared Access Signature or Shared Access Policy to make a local copy of BLOBs.

  • The estimated BLOB size is 500 MB to 1 GB

  • Internet connections vary from 250Kb to 4Mb

2
Can you clarify what you mean by "download"? you want to make a local copy of it or you want to use it in your application? And How large are we talking about? 1GB? 10GB? 50GB? How about your internet connectivity? how fast is it?Leonardo

2 Answers

2
votes

In case of REST API use the HTTP request header

In case of Storage Client Library for .NET use DownloadRangeToStream

1
votes

The best way depends upon your situation. Is there a specific reason preventing you from not to doing something along the lines of the following (Java code)? I have seen examples like this, but would be interested in learning why you think it might not work for you.

    public class SASread 
{
    public static void main(String[] args) throws URISyntaxException, FileNotFoundException, StorageException, IOException 
    {                       
    URI baseuri = new URI("http://greengrass.blob.core.windows.net");
    CloudBlobClient blobclient = new CloudBlobClient(baseuri);
    MyDownloadBlob("container1",
           "sr=c&sv=2012-02-12&sig=ADsFalIpE1XkaneQpWwtpM3AhY%2BAwiUtbbo1ANbIoJA%3D&si=r",
           blobclient);         
    }

    public static void MyDownloadBlob(String containerName, String containerSAS, CloudBlobClient blobClient) throws URISyntaxException, StorageException, FileNotFoundException, IOException
    {   
    String blobName = "image3.jpg";  
    String localFileName = "c:\\myoutputimages\\image3.jpg";  
    URI uri = new URI(blobClient.getEndpoint().toString() + "/" +
                      containerName + "/" + 
                      blobName + 
                      "?" + 
                      containerSAS);   
    CloudBlockBlob sasBlob = new CloudBlockBlob(uri, blobClient);   
    File fileTarget = new File(localFileName); 
    sasBlob.download(new FileOutputStream(fileTarget));
    System.out.println("The blob at:\n"  + uri + "\nwas downloaded from the cloud to local file:\n" + localFileName);   
    }
}