public async Task DeleteAsync(string fileName, EContainerName eContainerName) { var containerClient = _blobServiceClient.GetBlobContainerClient(eContainerName.ToString()); var blobClient = containerClient.GetBlobClient(fileName); await blobClient.DeleteAsync(); }
public async Task <Stream> DownloadAsync(string blobClientName, EContainerName eContainerName) { var containerClient = _blobServiceClient.GetBlobContainerClient(eContainerName.ToString()); var blobClient = containerClient.GetBlobClient(blobClientName); var downloadedFile = await blobClient.DownloadAsync(); return(downloadedFile.Value.Content); }
public async Task <Stream> DownloadAsync(string fileName, EContainerName eContanierName) { var contanierClient = _blobServiceClient.GetBlobContainerClient(eContanierName.ToString()); var blobClient = contanierClient.GetBlobClient(fileName); var info = await blobClient.DownloadAsync(); return(info.Value.Content); }
public List <string> GetNames(EContainerName eContainerName) { var blobNames = new List <string>(); var containerClient = _blobServiceClient.GetBlobContainerClient(eContainerName.ToString()); var blobs = containerClient.GetBlobs(); blobs.ToList().ForEach(b => blobNames.Add(b.Name)); return(blobNames); }
public async Task UploadAsync(Stream fileStream, string blobClientName, EContainerName eContainerName) { var containerClient = _blobServiceClient.GetBlobContainerClient(eContainerName.ToString()); await containerClient.CreateIfNotExistsAsync(); await containerClient.SetAccessPolicyAsync(Azure.Storage.Blobs.Models.PublicAccessType.BlobContainer); var blobClient = containerClient.GetBlobClient(blobClientName); await blobClient.UploadAsync(fileStream); }