public static Response <BlobContentInfo> Upload ( IAzureBlobClientBuilder clientBuilder, string blobName, string objectName, Stream streamToUpload, StorageTransferOptions transferOptions = default(StorageTransferOptions), EventHandler <AzureTransferProgressEventArgs> transferProgress = null, CancellationToken cancellationToken = default(CancellationToken) ) { if (clientBuilder == null) { throw new ArgumentNullException(nameof(clientBuilder)); } if (streamToUpload is null) { throw new ArgumentNullException(nameof(streamToUpload)); } var client = clientBuilder.GetBlobContainerClient(blobName).GetBlobClient(objectName); long streamLength = 0; if (streamToUpload.CanSeek) { streamLength = streamToUpload.Length; } return(client.Upload(streamToUpload, transferOptions: transferOptions, progressHandler: new AzureTransferProgressAdapter(streamLength, transferProgress), cancellationToken: cancellationToken)); }
public AzureBlobFileSystemClient(Guid runtimeId, AzureBlobConfig config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } RuntimeId = runtimeId; _ClientBuilder = new AzureBlobClientBuilder(config.ConnectionString); _ContainerName = config.BlobName; }