[
  {
    "Id": "638359",
    "ThreadId": "264162",
    "Html": "\r\n<p>I need to predict the length of a ZIP archive BEFORE I begin the process of generating an output stream.&nbsp; Individual files are being streamed from a remote server.&nbsp; It is adequate in my application that the ZIP archive contain uncompressed files.</p>\r\n<p>I have successfully created a ZIP archive size calculator which will calculate the correct size of a resulting ZIP archive given the path name and size of each file in the archive AND setting CompressionLevel == 'None'.&nbsp; I can calculate the size of\r\n the archive BEFORE it is generated and the calculated size exactly matches the generated size of the archive.&nbsp; The calculator accounts for file headers and descriptors, and directory meta data.</p>\r\n<p>This generally works as expected, at least on computers which do not have illuminated pictures of half eaten fruit on the cover.&nbsp; These archives will NOT work with the Mac OS Finder application.&nbsp; It is well documented that the Finder application\r\n on the Mac OS does not support ZIP archives containing uncompressed files.&nbsp; Why this is the case, only Steve and his minions can know.</p>\r\n<p>What DOES work on the Mac OS is a 'DEFLATE'd ZIP archive with NO underlying compression.&nbsp; In such a case, the corresponding ZIP archive (should) contain a DEFLATEd stream with ~64k (- 1) 'chunks' with 5 byte buffer separators containing buffer lengths.&nbsp;\r\n In theory, one should be able to accurately predict the size of such an archive.&nbsp; The only difference being to compute the number of chunks and account for an appropriate number of 5 byte buffer separators.</p>\r\n<p>Questions:</p>\r\n<p>1)&nbsp; Is there a way using DotNetZipLib to create an output stream that contains a 'DEFLATE'd stream with NO compression?</p>\r\n<p>2)&nbsp; If so, can the ~64k ( - 1) buffer boundaries be ACCURATELY predicted so as to accurately compute the size of the streamed image for each file in the ZIP archive?</p>\r\n<p>3)&nbsp; Is there any other way to generate a Mac Finder compatible ZIP archive containing otherwise uncompressed data (for which the size of the archive is predictable)?</p>\r\n<p>Any help or ideas would be greatly appreciated.</p>\r\n<p>EulerOperator</p>\r\n<p>(no Klein bottles please)</p>\r\n",
    "PostedDate": "2011-07-06T13:28:20.113-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "638915",
    "ThreadId": "264162",
    "Html": "<p>1. No - in DotNetZip, there is no way to use compression and get a non-compressed stream, or a stream sliced into chunks delimited by the 5-byte segment separators. I suppose you could write that yourself if its important to you.</p>\r\n<p>2.&nbsp; if you wrote something, then I guess you could accurately predict the size.</p>\r\n<p>3. I can't imagine another way.</p>\r\n<p>&nbsp;</p>\r\n<p>I find myself wondering why you need to predict the size of the archive. Maybe there is a way to wiggle out of that requirement, which would then allow you to use compression.</p>",
    "PostedDate": "2011-07-07T11:13:15.09-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]