Пример #1
0
        public static string DownloadText(this IBlobStorageClient blobStorageClient, string blobName)
        {
            blobStorageClient.Require("blobStorageClient");
            blobName.Require("blobName");

            using (var outputStream = new MemoryStream())
            {
                blobStorageClient.DownloadBlob(blobName).CopyTo(outputStream);
                return(Encoding.UTF8.GetString(outputStream.ToArray()));
            }
        }
Пример #2
0
        public static byte[] DownloadBytes(this IBlobStorageClient blobStorageClient, string blobName)
        {
            blobStorageClient.Require("blobStorageClient");
            blobName.Require("blobName");

            using (var outputStream = new MemoryStream())
            {
                blobStorageClient.DownloadBlob(blobName).CopyTo(outputStream);
                return(outputStream.ToArray());
            }
        }
Пример #3
0
        public static void DownloadFile(this IBlobStorageClient blobStorageClient, string filePath, string blobName)
        {
            blobStorageClient.Require("blobStorageClient");
            filePath.Require("filePath");
            blobName.Require("blobName");

            using (var blobStream = blobStorageClient.DownloadBlob(blobName))
                using (var fileStream = File.Create(filePath))
                {
                    blobStream.CopyTo(fileStream);
                }
        }