Show / Hide Table of Contents

Class BlobStorageHelper

Helper class for Azure Blob storage.

Inheritance
System.Object
BlobStorageHelper
Namespace: DNVGL.One.Compute.StorageLibrary.Azure.FileTransfer
Assembly: DNVGL.One.Compute.StorageLibrary.Azure.dll
Syntax
public static class BlobStorageHelper : object

Methods

View Source

DeleteDirectoryIfExistsAsync(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 .

View Source

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 .

View Source

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.

View Source

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 instance containing the event data.

Returns
Type Description
System.String

A checksum.

View Source

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.

View Source

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.

View Source

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.

View Source

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 true [use flat BLOB listing].

Returns
Type Description
IEnumerable<IListBlobItem>

The blob items in the directory.

View Source

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.

View Source

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.

View Source

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 .

  • View Source
In This Article
Back to top Copyright © DNV AS. All rights reserved.