Minimal ZIP file – part I 
       ============================
       
       
       This article is part of a series. 
       
       - Creating a valid ZIP-file 👈 
 (DIR) Use .NET’s DeflateStream
 (DIR) No dependencies (coding the DEFLATE algorithm)
 (DIR) Calculating the CRC-32
       
       Introduction 
       -------------
       
       
       How difficult is it to create a ZIP-file 1 with a bare minimum 2 - but readable - amount of code? 
       
 (DIR) 1
 (DIR) 2
       
       To go slowly, we do this in a few steps. Each in their own article. The first step is to create a valid, but not very optimal ZIP-file (i.e., uncompressed). 
       
       
       The code is in C# but should be easy to follow for people with knowledge of other languages. No exotic syntax or tricks are used. If something is unclear or can be done better, let me know . 
       
 (DIR) let me know
       
       File format 
       ------------
       
       
       For a little background, these are the parts of a ZIP-file with two files: 
       
 (DIR) zip-file-layout.svg
       
       The individual parts contain things like file names, file sizes, checksums and compressed data. 
       
       
       Source code 
       ------------
       
       
       The main code is only a few lines and follows the said file layout. 
       
       
       In fact, that is most of it. The called functions only contain writing numbers, strings and data to a file. 
       
       
       The entire source code is 100 lines. Readability is the main goal. 
       
       
       As said, this is a valid ZIP-file with no compression. So it actually inflates your data because of the headers. 
       
       
       The full code can be found in Zip1.cs . 
       
 (DIR) Zip1.cs
       
       The proof is in the pudding 
       ----------------------------
       
       
       PKZIP 2.04g (Jan ‘93) confirms that it is a valid ZIP-file. 
       
       
       
       
 (DIR) 
 (IMG) pkunzip 2.04g doing it’s work (.png) 
       
       Info-ZIP’s zip agrees: 
       
       
       Info-ZIP’s zipinfo is also a great tool to inspect ZIP-files. 
       
       
       Next up 
       --------
       
       
       In the next part we’ll cheat a little and use .NET’s DeflateStream to create a more useful ZIP-file. 
       
 (DIR) next part
       ----------------------------------
       -  Wikipedia: ZIP (file format)  ↩︎  
       
       Wikipedia: ZIP (file format)  ↩︎ 
       
 (HTM) ZIP (file format) 
 (DIR) ↩︎
       -  The title of this article is about the code, not about the size of the created ZIP-file. Good find, Bertrik Sikken ! ↩︎  
       
       The title of this article is about the code, not about the size of the created ZIP-file. Good find, Bertrik Sikken ! ↩︎ 
       
 (HTM) Bertrik Sikken 
 (DIR) ↩︎
 (DIR) previous Data compression 101
       
 (DIR) next Minimal ZIP file – part II
       
       
       Related 
       --------
       
 (DIR) Gopher enabled
 (TXT) Goofy gopher (.svg) 
 (DIR) http2gopher
 (TXT) /img/fallback.svg (.svg) 
 (DIR) Data compression 101
 (TXT) /img/fallback.svg (.svg) 
 (DIR) [Talk] Datacompressie
 (TXT) bits (.svg) 
 (DIR) Delphi Tetris
 (IMG) Delphi Tetris (.png) 
 (DIR) PicoSearch - TF-IDF in 50 lines
 (TXT) /img/fallback.svg (.svg) 
 (DIR) Software engineering, een volwassen vak?
 (IMG) Boekje (.jpeg) 
 (DIR) Blaztris
 (TXT) /img/fallback.svg (.svg) 
 (DIR) Upgrade application without source code
 (TXT) Bits (.svg) 
 (DIR) Colossus PoC
 (IMG) screenshot of colossus visualiser and malfunction controller (.png)