From f340f50c943a7d85b138dc55125c9c10c6415407 Mon Sep 17 00:00:00 2001 From: Titouan CREACH Date: Fri, 7 Oct 2022 09:45:49 +0200 Subject: [PATCH] =?UTF-8?q?Possibilit=C3=A9=20d'upload=20en=20b64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Helpers/FluentBlobStorage.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Helpers/FluentBlobStorage.cs b/Helpers/FluentBlobStorage.cs index d2c929f..deb11f0 100644 --- a/Helpers/FluentBlobStorage.cs +++ b/Helpers/FluentBlobStorage.cs @@ -94,6 +94,20 @@ public FluentBlobStorage WithContentType(string contentType) return (blobClient.Uri, res); } + public async Task<(Uri, Azure.Response)> UploadAsync(string b64) + { + AssertGuards(); + + BlobServiceClient blobServiceClient = new(ConnectionString); + BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(ContainerName); + BlobClient blobClient = containerClient.GetBlobClient(FileName); + + var res = await blobClient.UploadAsync(Convert.FromBase64String(b64), Headers); + + return (blobClient.Uri, res); + } + + public (Stream, BlobProperties) OpenRead() { AssertGuards();