Geek alert: anyone familiar with zlib? Docs are super confusing but essentially I am trying to wrap it up inside an api that does compress a chunk, process a chunk. To do that I need a final call to pass Z_FINISH. Problem is I either have to know whether each call I make is the last chunk or not. Ideally I’d like to treat each chunk the same and pass Z_SYNC_FLUSH and then in some finalise call I essentially pass a zero length buffer and Z_FINISH then deflateEnd.