[
  {
    "Id": "248625",
    "ThreadId": "72797",
    "Html": "<p>Hi</p>\r\n<p>I have this:</p>\r\n<p>&nbsp;</p>\r\n<p>ZipFile zf = new ZipFile();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zf.Encryption = EncryptionAlgorithm.WinZipAes128;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zf.CompressionLevel = CompressionLevel.BestCompression;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zf.AddFile(srcfileName);</p>\r\n<p>Here without saving this file to hard disk i would like to get the byte[] of zip file.</p>\r\n<p>Just wondering if it is possible.</p>\r\n<p>Thanks</p>\r\n<p>N</p>",
    "PostedDate": "2009-10-22T08:43:47.21-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "248684",
    "ThreadId": "72797",
    "Html": "<p>Yes, you should save the ZipFile to a memorystream (use <a href=\"http://cheeso.members.winisp.net/DotNetZipHelp/html/8b981f77-742a-5f47-6299-c27104871d8c.htm\">ZipFile.Save(Stream)</a> method) , and then use the MemoryStream.ToArray() method to get the byte array.</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Blue\">using</span> (<span style=\"color:Blue\">var</span> zip = <span style=\"color:Blue\">new</span> Ionic.Zip.ZipFile())\r\n{\r\n    zip.CompressionLevel= Ionic.Zlib.CompressionLevel.BestCompression;\r\n    zip.Password = <span style=\"color:#A31515\">&quot;VerySecret.&quot;</span>;\r\n    zip.Encryption = EncryptionAlgorithm.WinZipAes128;\r\n    zip.AddFile(sourceFileName);\r\n    MemoryStream output = <span style=\"color:Blue\">new</span> MemoryStream();\r\n    zip.Save(output);\r\n\r\n    <span style=\"color:Blue\">byte</span>[] zipbytes = output.ToArray();\r\n}\r\n\r\n</pre>\r\n</div>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-10-22T10:48:53.697-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "248853",
    "ThreadId": "72797",
    "Html": "<p>Thanks Cheeso.</p>",
    "PostedDate": "2009-10-22T21:27:25.767-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]