API to retrieve partial chunks from Inflater
makkarpov opened this issue · comments
Suppose the following scenario: server sends compressed messages, but uses single deflater instance to compress entire stream, flushing the deflater with Z_SYNC_FLUSH
between messages. This way deflater could exploit inter-message redundancy.
Now we are trying to decompress such first message in the stream (which is complete because encoder was flushed after it). pako succeeds, but outputs nothing. All decompressed data is left in strm.output
buffer, waiting to form a full chunk.
Suggestion: add method to flush decoder, or use existing flush
argument to flush the remaining data as a separate chunk.
In short: i have nothing againts your case. But i can't create tests myself, and still responsible for maintenance
Short but not nice way - https://github.com/nodeca/pako/tree/master/lib/zlib. You have access to original zlib. Just write any wrapper you wish for your needs.
Existing API change is not obvious due lack of testing possibilities for all scenarios. I'm closing issue, but we can continue if you wish. As far as i remember, forced flush of inflate was wropped after wrapper rewrite due lack of tests. try fo dig tracker and let me know what do you think.