Skip to content

Instantly share code, notes, and snippets.

@jvanhoesen
Created February 2, 2022 21:18
Show Gist options
  • Save jvanhoesen/9e112922347f6bd3d21c62f552af0d6a to your computer and use it in GitHub Desktop.
Save jvanhoesen/9e112922347f6bd3d21c62f552af0d6a to your computer and use it in GitHub Desktop.
Addition of file to created .Zip archive
using (ZipArchive zip = ZipArchive.CreateFrom(zipStream, false))
{
using (MemoryStream fileStream = new MemoryStream())
{
fileStream.Seek(0, SeekOrigin.Begin);
file.Write(fileStream);
fileStream.Seek(0, SeekOrigin.Begin);
zip.AddFile(fileName, fileStream.ToArray());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment