I need to create a byte array, with the zip of multiple byte arrays. I don't want to generate files during the process. I have coded what is displayed next:
FileStream tempFileStream = new FileStream(@"C:\test.zip", FileMode.Open, FileAccess.ReadWrite, FileShare.None);
Stream compressedContents = new MemoryStream();
ZipOutputStream zipOutput = new ZipOutputStream(compressedContents);
for (int i = 0; i < attachments.Count; i++) //attachments -> byte 
The file defined is only for testing purposes. When I try to open it, appears the usual error when a file is broken: "can not open test.zip as an archive".
If variable compressedContents is directly a FileStream, instead of a MemoryStream, the test file is created correctly. The problem may be on the way I use the memoryStream or the buffer...But it seems all correct for me!! Any solutions for this?