[PR #448] Python: Support streamed compression with the Compressor object #1070

Closed
opened 2026-01-29 20:52:22 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/google/brotli/pull/448

State: closed
Merged: Yes


Add flush and finish methods to the Compressor object in
the extension module and change compress to only process data.
Now, one or more compress calls followed by a finish call
will be equivalent to a module-level compress call.

Note: To maximize the compression efficiency (and match
underlying Brotli behavior, the Compressor object compress
method does not guarantee all input is immediately written to
output. To ensure immediate output, call flush to manually
flush the compression buffer. Extraneous flushing can increase
the size, but may be required when processing streaming data.


edited Oct 19: see updated description in commit and the thread below

**Original Pull Request:** https://github.com/google/brotli/pull/448 **State:** closed **Merged:** Yes --- Add `flush` and `finish` methods to the `Compressor` object in the extension module and change `compress` to only process data. Now, one or more `compress` calls followed by a `finish` call will be equivalent to a module-level `compress` call. Note: To maximize the compression efficiency (and match underlying Brotli behavior, the `Compressor` object `compress` method does not guarantee all input is immediately written to output. To ensure immediate output, call `flush` to manually flush the compression buffer. Extraneous flushing can increase the size, but may be required when processing streaming data. --- _edited Oct 19: see updated description in commit and the thread below_
claunia added the pull-request label 2026-01-29 20:52:22 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#1070