Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/ServiceStack.Azure/Storage/AzureBlobVirtualFiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ public void WriteFile(string filePath, string textContents)
public void WriteFile(string filePath, Stream stream)
{
var blob = Container.GetBlockBlobReference(SanitizePath(filePath));
blob.Properties.ContentType = MimeTypes.GetMimeType(filePath);

if (stream.Length > 1014 * 1024 * 100) // 100 mb
{
blob.ServiceClient.DefaultRequestOptions.SingleBlobUploadThresholdInBytes = 1014 * 1024 * 10;
blob.ServiceClient.DefaultRequestOptions.ParallelOperationThreadCount = Environment.ProcessorCount;
blob.Properties.ContentType = MimeTypes.GetMimeType(filePath);
}
blob.UploadFromStream(stream);
}

Expand Down Expand Up @@ -131,7 +137,7 @@ public string GetDirPath(string filePath)

public IEnumerable<AzureBlobVirtualFile> EnumerateFiles(string dirPath = null)
{
return Container.ListBlobs(dirPath == null ? null : dirPath + this.RealPathSeparator, useFlatBlobListing:true)
return Container.ListBlobs(dirPath == null ? null : dirPath + this.RealPathSeparator, useFlatBlobListing: true)
.OfType<CloudBlockBlob>()
.Select(q => new AzureBlobVirtualFile(this, new AzureBlobVirtualDirectory(this, GetDirPath(q))).Init(q));
}
Expand Down