zlib
underlies most zip
file decompressors, and DEFLATE is one the binary formats used to store compressed data in a bitstream.
The goal of this article is to walk through how my Python DEFLATE compressor implementation works. There are many
guides on the internet that describe how to implement each step of DEFLATE, but very few end up producing a bitstream
that can actually be parsed by a library like zlib
. This article assumes that you roughly know how each step of the DEFLATE algorithm
is implemented, but are having trouble with some of the finer points that are often glossed over.
The code can be found in "deflate.py".