yjh0502 / erl-brotli

Brotli encoder NIF for Erlang
Other
29 stars 17 forks source link

Feature request: add a "flush()" API #13

Open ewildgoose opened 2 years ago

ewildgoose commented 2 years ago

Hi, I would like to use Brotli for compressing a stream of data. For this reason it's necessary to be able to "flush" the stream at the end of a frame (whatever the app is doing to frame the data stream).

The issue is that if the stream sends some number of bytes to the encoder, the encoder might not necessarily emit enough data to the output to allow the decoder to fully decode that input. A "flush" forces the encoder to empty it's state and transmit any pending data (it hurts compression performance, but emits the buffered data)

This extra API call would make the brotli library useful for a wider array of use cases.

Thanks for listening