Class AzureBlobProvider
Encapsulates functionality to interact with Azure blob storage.
Inheritance
System.Object
AzureBlobProvider
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: CrashCABN.DataAccess
Assembly: CrashCABN.DataAccess.dll
Syntax
public class AzureBlobProvider : IAzureBlobProvider
Constructors
View SourceAzureBlobProvider(IOptions<DataAccessOptions>, IAlternateStorageConnection)
Declaration
public AzureBlobProvider(IOptions<DataAccessOptions> dataAccessOptions, IAlternateStorageConnection alternateStorage = null)
Parameters
Type | Name | Description |
---|---|---|
IOptions<DataAccessOptions> | dataAccessOptions | |
IAlternateStorageConnection | alternateStorage |
Methods
View SourceBlobExistsAsync(Uri)
Checks if the blob exists for downloading.
Declaration
public async Task<bool> BlobExistsAsync(Uri blobUri)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | blobUri | The absolute blob URI. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | True if it exists. |
GetBlobStreamAndHashAsync(Uri)
Retrieves the blob stream for downloading and a content hash.
Declaration
public async Task<(Stream Stream, byte[] Hash)> GetBlobStreamAndHashAsync(Uri blobUri)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | blobUri | The absolute blob URI. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.ValueTuple<System.IO.Stream, System.Byte[]>> | The stream for downloading and a content hash. |
GetBlobStreamAsync(Uri)
Retrieves the blob stream for downloading.
Declaration
public async Task<Stream> GetBlobStreamAsync(Uri blobUri)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | blobUri | The absolute blob URI. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.IO.Stream> | The stream for downloading. |
ListBlobsInPathAsync(Uri)
Lists the blobs in the given container path.
Declaration
public IAsyncEnumerable<string> ListBlobsInPathAsync(Uri blobUri)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | blobUri | The full URL to the Azure storage container and folder to search in. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<System.String> | An enumeration containing the full path of each blob. |
WriteBlobStreamAsync(Uri, Stream)
Uploads the stream to given the blob URI.
Declaration
public Task WriteBlobStreamAsync(Uri blobUri, Stream content)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | blobUri | The absolute blob URI. |
System.IO.Stream | content | The stream for uploading. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task representing the asynchronous operation. |