We need to read media files. So, a text file is stored "for this page" or "for this block" and we need to read the contents of it from code.
I was doing this quite fine, but then I found out that my method (below) required the provider to be the local file system.
As soon as we deployed to Azure, this fell apart.
I have to assume there is a universal, storage-agnostic way of reading files from MediaData objects, but Google is polluted with code from several versions back. What's the latest, accepted way of doing this that will work no matter where a site is hosted?
So, this works, but I'm still curious if this is storage-agnostic. Will this work for every possible storage provider?
var blob = media.BinaryData;
using (var stream = blob.OpenRead())
var reader = new StreamReader(stream);