I have a situation where I have PDF files stored in a database as Base64 data in VARCHAR(MAX)
columns. These are accessed from an ASP.NET Core MVC app. Users need to be able to view and download these files in a browser. Currently, we return the data as a string
from a query, use Convert.FromBase64String()
and return the converted byte[]
as FileContentResult
.
The problem is some files are very large, and are causing timeout issues when converting to a byte array. I would prefer to be able to stream the result back to users as it's being decoded instead of having to do it all up front, but I'm not sure how. Would it be possible to somehow decode the Base64 string in chunks and stream it back as FileStreamResult
instead?