In my web api I need to receive files and then save them in blob storage. Clients are not allowed to access and are not aware of blob storage. I'm trying to avoid buffering of files which could be up to 300MB in size. I've seen this post How to I pass a stream from Web API to Azure Blob storage without temp files? but the solution described in the post is not going to work for me because it assumes multi-part content which in turn allows for custom provider. Clients that I need to deal with are not sending files using multi-part content. Instead, they simply send file content in message bodies.
Here is what works for me now (with buffering):
using (var inStream = await this.Request.Content.ReadAsStreamAsync())
{
var blob = container.GetBlockBlobReference(fileName);
var outStream = await blob.OpenWriteAsync();
await inStream.CopyToAsync(outStream);
outStream.Close();
}
Is there a way to connect request's stream with blob stream without the first being buffered?