This question is more related to buffer processing than to the compression algorithm, although a little can be said about this.
Some compression algorithms are inherently “block-based”, which means that they absolutely need to work with blocks of a certain size. This is the situation with bzip2, the block size of which is selected thanks to the level switch, from 100 kB to 900 kB. Thus, if you transfer data to it, it will wait for the block to be filled and begin to compress this block when it is full (as an alternative to the last block, it will work with any size it receives).
Some other compression algorithms can process streams, which means that they can continuously compress new data using the older one stored in the memory buffer. Sliding window algorithms can do this, and usually zlib can achieve this.
Now even sliding-window compressors can, however, choose to cut input into blocks, either to simplify buffer management or to develop multi-threading capabilities such as pigz.
Cyan source share