Skip to content

Commit fc38f1e

Browse files
Merge pull request #238740 from pauljewellmsft/pauljewell-download
Add sections for download options
2 parents 9e771ef + 05da259 commit fc38f1e

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

articles/storage/blobs/storage-blob-download.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services: storage
66
author: pauljewellmsft
77

88
ms.author: pauljewell
9-
ms.date: 04/21/2023
9+
ms.date: 05/23/2023
1010
ms.service: storage
1111
ms.subservice: blobs
1212
ms.topic: how-to
@@ -23,7 +23,7 @@ This article shows how to download a blob using the [Azure Storage client librar
2323
To work with the code examples in this article, make sure you have:
2424

2525
- An authorized client object to connect to Blob Storage data resources. To learn more, see [Create and manage client objects that interact with data resources](storage-blob-client-management.md).
26-
- Permissions to perform an upload operation. To learn more, see the authorization guidance for the following REST API operation:
26+
- Permissions to perform a download operation. To learn more, see the authorization guidance for the following REST API operation:
2727
- [Get Blob](/rest/api/storageservices/get-blob#authorization)
2828
- The package **Azure.Storage.Blobs** installed to your project directory. To learn more about setting up your project, see [Get Started with Azure Storage and .NET](storage-blob-dotnet-get-started.md#set-up-your-project).
2929

@@ -65,6 +65,35 @@ The following example downloads a blob by reading from a stream:
6565

6666
:::code language="csharp" source="~/azure-storage-snippets/blobs/howto/dotnet/BlobDevGuideBlobs/DownloadBlob.cs" id="Snippet_DownloadBlobFromStream":::
6767

68+
## Download a block blob with configuration options
69+
70+
You can define client library configuration options when downloading a blob. These options can be tuned to improve performance and enhance reliability. The following code examples show how to use [BlobDownloadToOptions](/dotnet/api/azure.storage.blobs.models.blobdownloadtooptions) to define configuration options when calling an download method. Note that the same options are available for [BlobDownloadOptions](/dotnet/api/azure.storage.blobs.models.blobdownloadoptions).
71+
72+
### Specify data transfer options on download
73+
74+
You can configure the values in [StorageTransferOptions](/dotnet/api/azure.storage.storagetransferoptions) to improve performance for data transfer operations. The following code example shows how to set values for `StorageTransferOptions` and include the options as part of a `BlobDownloadToOptions` instance. The values provided in this sample aren't intended to be a recommendation. To properly tune these values, you need to consider the specific needs of your app.
75+
76+
:::code language="csharp" source="~/azure-storage-snippets/blobs/howto/dotnet/BlobDevGuideBlobs/DownloadBlob.cs" id="Snippet_DownloadBlobWithTransferOptions":::
77+
78+
To learn more about tuning data transfer options, see [Performance tuning for uploads and downloads](storage-blobs-tune-upload-download.md).
79+
80+
### Specify transfer validation options on download
81+
82+
You can specify transfer validation options to help ensure that data is downloaded properly and hasn't been tampered with during transit. Transfer validation options can be defined at the client level using [BlobClientOptions](/dotnet/api/azure.storage.blobs.blobclientoptions), which applies validation options to all methods called from a [BlobClient](/dotnet/api/azure.storage.blobs.blobclient) instance.
83+
84+
You can also override transfer validation options at the method level using [BlobDownloadToOptions](/dotnet/api/azure.storage.blobs.models.blobdownloadtooptions). The following code example shows how to create a `BlobDownloadToOptions` object and specify an algorithm for generating a checksum. The checksum is then used by the service to verify data integrity of the downloaded content.
85+
86+
:::code language="csharp" source="~/azure-storage-snippets/blobs/howto/dotnet/BlobDevGuideBlobs/DownloadBlob.cs" id="Snippet_DownloadBlobWithChecksum":::
87+
88+
The following table shows the available options for the checksum algorithm, as defined by [StorageChecksumAlgorithm](/dotnet/api/azure.storage.storagechecksumalgorithm):
89+
90+
| Name | Value | Description |
91+
| --- | --- | --- |
92+
| Auto | 0 | Recommended. Allows the library to choose an algorithm. Different library versions may choose different algorithms. |
93+
| None | 1 | No selected algorithm. Don't calculate or request checksums.
94+
| MD5 | 2 | Standard MD5 hash algorithm. |
95+
| StorageCrc64 | 3 | Azure Storage custom 64-bit CRC. |
96+
6897
## Resources
6998

7099
To learn more about how to download blobs using the Azure Blob Storage client library for .NET, see the following resources.

0 commit comments

Comments
 (0)