I have a readonly System.IO.Stream implementation that is not seekable (and its Position always returns 0). I need to send it to a consumer that do
If using System.Net.WebClient, instead of using OpenRead() which returns a Stream use webClient.DownloadData("https://your.url") to get a byte array which you can then turn into a MemoryStream. Here is an example:
byte[] buffer = client.DownloadData(testBlobFile);
using (var stream = new MemoryStream(buffer))
{
... your code using the stream ...
}
Obviously this downloads everything before the Stream is created, so it may defeat the purpose of using a Stream.