As you can see this solution is pretty straight forward. Through the use of a memorystream and header manipulation you are able to dynamically retrieve data from a sharepoint content database and send it to the browser as a file.