Class BlobStorageHelper
Helper class for Azure Blob storage.
Inheritance
Namespace: DNVGL.One.Compute.StorageLibrary.Azure.FileTransfer
Assembly: DNVGL.One.Compute.StorageLibrary.Azure.dll
Syntax
public static class BlobStorageHelper : object
Methods
View SourceDeleteDirectoryIfExistsAsync(CloudBlobContainer, String)
Deletes the directory if it exists.
Declaration
public static async Task DeleteDirectoryIfExistsAsync(this CloudBlobContainer blobContainer, string directory)
Parameters
Type | Name | Description |
---|---|---|
CloudBlobContainer | blobContainer | The BLOB container. |
System.String | directory | The directory. |
Returns
Type | Description |
---|---|
Task | Asynchronous |
DeleteFileIfExistsAsync(CloudBlobContainer, Uri)
Deletes the file if it exists.
Declaration
public static async Task DeleteFileIfExistsAsync(this CloudBlobContainer blobContainer, Uri fileUri)
Parameters
Type | Name | Description |
---|---|---|
CloudBlobContainer | blobContainer | The BLOB container. |
Uri | fileUri | The file URI. |
Returns
Type | Description |
---|---|
Task | Asynchronous |
GetAzureBlobCheckSum(CloudBlockBlob)
Gets the (MD5) checksum of an Azure BLOB.
Declaration
public static string GetAzureBlobCheckSum(CloudBlockBlob blockBlob)
Parameters
Type | Name | Description |
---|---|---|
CloudBlockBlob | blockBlob | The block BLOB. |
Returns
Type | Description |
---|---|
System.String | An Azure BLOB MD5 checksum. |
GetAzureBlobCheckSum(DataTransferEventArgs)
Gets the (MD5) checksum of an Azure BLOB represented by a
Declaration
public static string GetAzureBlobCheckSum(DataTransferEventArgs dataTransferEventArgs)
Parameters
Type | Name | Description |
---|---|---|
DataTransferEventArgs | dataTransferEventArgs | The |
Returns
Type | Description |
---|---|
System.String | A checksum. |
GetLocalFileCheckSum(String)
Gets the (MD5) checksum of a local file.
Declaration
public static string GetLocalFileCheckSum(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path to the local file. |
Returns
Type | Description |
---|---|
System.String | A checksum. |
GetLocalFileLength(String)
Gets the length of a local file.
Declaration
public static long GetLocalFileLength(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path to the file. |
Returns
Type | Description |
---|---|
System.Int64 | A local file length. |
GetResourceFileUri(CloudBlobClient, String, String, SharedAccessBlobPolicy)
Gets the resource file URI.
Declaration
public static string GetResourceFileUri(this CloudBlobClient blobClient, string containerName, string filePath, SharedAccessBlobPolicy sasConstraints)
Parameters
Type | Name | Description |
---|---|---|
CloudBlobClient | blobClient | The BLOB client. |
System.String | containerName | Name of the container. |
System.String | filePath | The file path. |
SharedAccessBlobPolicy | sasConstraints | The shared access signature constraints. |
Returns
Type | Description |
---|---|
System.String | A resource file URI. |
ListBlobs(CloudBlobDirectory, Boolean)
Lists the blobs asynchronously.
Declaration
public static IEnumerable<IListBlobItem> ListBlobs(this CloudBlobDirectory blobDirectory, bool useFlatBlobListing = false)
Parameters
Type | Name | Description |
---|---|---|
CloudBlobDirectory | blobDirectory | The BLOB directory. |
System.Boolean | useFlatBlobListing | if set to |
Returns
Type | Description |
---|---|
IEnumerable<IListBlobItem> | The blob items in the directory. |
UploadFiles(CloudBlobContainer, IEnumerable<String>, IEnumerable<String>, Action<Int64>)
Uploads the files asynchronously.
Declaration
public static void UploadFiles(this CloudBlobContainer blobContainer, IEnumerable<string> files, IEnumerable<string> blobNames, Action<long> callback)
Parameters
Type | Name | Description |
---|---|---|
CloudBlobContainer | blobContainer | The BLOB container. |
IEnumerable<System.String> | files | The files. |
IEnumerable<System.String> | blobNames | The BLOB names (must match the files). |
Action<System.Int64> | callback | The callback. |
UploadFiles(CloudBlobContainer, String, IEnumerable<String>, Action<Int64>)
Uploads the files asynchronously.
Declaration
public static void UploadFiles(this CloudBlobContainer blobContainer, string sourceFolder, IEnumerable<string> files, Action<long> callback)
Parameters
Type | Name | Description |
---|---|---|
CloudBlobContainer | blobContainer | The BLOB container. |
System.String | sourceFolder | The source folder. |
IEnumerable<System.String> | files | The files. |
Action<System.Int64> | callback | The callback. |
UploadFilesAsync(CloudBlobContainer, IEnumerable<String>, IEnumerable<String>, Action<Int64>)
Uploads the files asynchronously.
Declaration
public static async Task UploadFilesAsync(this CloudBlobContainer blobContainer, IEnumerable<string> files, IEnumerable<string> blobNames, Action<long> callback)
Parameters
Type | Name | Description |
---|---|---|
CloudBlobContainer | blobContainer | The BLOB container. |
IEnumerable<System.String> | files | The files. |
IEnumerable<System.String> | blobNames | The BLOB names (must match the files). |
Action<System.Int64> | callback | The callback. |
Returns
Type | Description |
---|---|
Task | Asynchronous |