Created
February 2, 2022 21:18
-
-
Save jvanhoesen/9e112922347f6bd3d21c62f552af0d6a to your computer and use it in GitHub Desktop.
Addition of file to created .Zip archive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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