public static void UploadFile(this IBlobStorageClient blobStorageClient, string filePath, string blobName) { blobStorageClient.Require("blobStorageClient"); filePath.Require("filePath"); blobName.Require("blobName"); blobStorageClient.UploadBlob(new MemoryStream(File.ReadAllBytes(filePath)), blobName); }
public static void UploadText(this IBlobStorageClient blobStorageClient, string text, string blobName) { blobStorageClient.Require("blobStorageClient"); text.Require("text"); blobName.Require("blobName"); blobStorageClient.UploadBlob(new MemoryStream(Encoding.UTF8.GetBytes(text)), blobName); }
public static void UploadBytes(this IBlobStorageClient blobStorageClient, byte[] bytes, string blobName) { blobStorageClient.Require("blobStorageClient"); bytes.Require("bytes"); blobName.Require("blobName"); if (bytes.Length == 0) { throw new ArgumentException("Byte array is empty.", "bytes"); } blobStorageClient.UploadBlob(new MemoryStream(bytes), blobName); }