public async Task <string> GetReadOnlyBlobSasToken(string containerName, string folderName, string fileName) { // container var container = await StorageUtils.GetBlobContainer(_cloudStorageAccount, containerName); var blobName = StorageUtils.GetFileName(container, folderName, fileName); return(StorageUtils.GetReadOnlyBlobSasUri(container, blobName)); }
private async Task <CloudBlockBlob> GetWritableBlob(string containerName, string fileName, string folderName = null) { // get/create container var container = await StorageUtils.GetBlobContainer(_cloudStorageAccount, containerName); // generate the nested file name string nestedFileName = folderName != null ? $"{folderName}{container.ServiceClient.DefaultDelimiter}{fileName}" : $"{fileName}"; // get sas token var sasUri = StorageUtils.GetBlobSasUri(container, nestedFileName, null); // Return a reference to the blob using the SAS URI. This allows us to upload file contents without having to submit SAS as a query. return(new CloudBlockBlob(new Uri(sasUri))); }
private async Task <long> GetBlobSize(CloudBlockBlob blob) { return(await StorageUtils.GetBlobSize(blob)); }
public CloudStorageService(IConfiguration configuration) { _cloudStorageAccount = StorageUtils.GetCloudStorageAccount(configuration["Azure:Storage:ConnectionString"]); }
private async Task <bool> UploadBlobToContainer(CloudBlockBlob blob, byte[] fileContent) { return(await StorageUtils.UploadBlob(blob, fileContent)); }