IPWorks Cloud 2020 C++ Builder Edition

Questions / Feedback?

GetBlob Method

Downloads a blob.

Syntax

void __fastcall GetBlob(String Blob);

Remarks

This methods downloads the specified Blob in the container currently selected by Container. If Snapshot is non-empty, the specified snapshot of Blob is downloaded instead. The Range property can be used to download a specific range of bytes from the blob.

If the specified blob has an active lease, a lease Id may optionally be specified using LeaseId; the request will only succeed if the correct lease Id is specified.

If LocalFile is set, the blob data will be saved to the specified location; otherwise, the blob data will be held by ResourceData.

To download and decrypt an encrypted blob, set EncryptionAlgorithm and EncryptionPassword before calling this method.

Download Notes

In the simplest use-case, downloading a blob looks like this:

azureblob.LocalFile = "../MyData.zip";
azureblob.GetBlob(azureblob.Blobs[0].Name);

Resuming Downloads

The component also supports resuming failed downloads by using the StartByte property. If a download is interrupted, set StartByte to the appropriate offset before calling this method to resume the download.

string downloadFile = "../MyData.zip";
azureblob.LocalFile = downloadFile;
azureblob.GetBlob(azureblob.Blobs[0].Name);

//The transfer is interrupted and GetBlob() above fails. Later, resume the download:

//Get the size of the partially downloaded file
azureblob.StartByte = new FileInfo(downloadFile).Length;
azureblob.GetBlob(azureblob.Blobs[0].Name);

Resuming Encrypted File Downloads

Resuming encrypted file downloads is only supported when LocalFile was set in the initial download attempt.

If LocalFile is set when beginning an encrypted download, the component creates a temporary file in TempPath to hold the encrypted data until the download is complete. If the download is interrupted, DownloadTempFile will be populated with the path of the temporary file that holds the partial data.

To resume, DownloadTempFile must be populated, along with StartByte, to allow the remainder of the encrypted data to be downloaded. Once the encrypted data is downloaded it will be decrypted and written to LocalFile.

azureblob.LocalFile = "../MyData.zip";
azureblob.EncryptionPassword = "password";
azureblob.GetBlob(azureblob.Blobs[0].Name);

//The transfer is interrupted and GetBlob() above fails. Later, resume the download:

//Get the size of the partially downloaded temp file
azureblob.StartByte = new FileInfo(azureblob.Config("DownloadTempFile")).Length;
azureblob.GetBlob(azureblob.Blobs[0].Name);

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Cloud 2020 C++ Builder Edition - Version 20.0 [Build 8265]