Simple. Instead of spitting the raw bytes back out to the browser, write them to a file.