July 2016

Zipping up files from a MemoryStream

Recently I needed to write some .NET code that zipped up some files and downloaded the zip without touching the file system. I struggled to find a good example, so I thought I’d post the code here …

Assuming that we’ve got the source files in memory in the following structure:

We can use the following code to zip these files up and send the zip in the response:

Connect with me:RSSGitHubTwitterLinkedIn