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

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

📋 Pull Request Information

Original PR: https://github.com/google/brotli/pull/448
Author: @nicksay
Created: 10/18/2016
Status: Merged
Merged: 10/24/2016
Merged by: @eustas

Base: masterHead: py-4-compressor-multi


📝 Commits (1)

  • cc27fa8 Python: Support streamed compression with the Compressor object

📊 Changes

2 files changed (+135 additions, -33 deletions)

View changed files

📝 python/_brotli.cc (+133 -31)
📝 python/brotli.py (+2 -2)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/google/brotli/pull/448 **Author:** [@nicksay](https://github.com/nicksay) **Created:** 10/18/2016 **Status:** ✅ Merged **Merged:** 10/24/2016 **Merged by:** [@eustas](https://github.com/eustas) **Base:** `master` ← **Head:** `py-4-compressor-multi` --- ### 📝 Commits (1) - [`cc27fa8`](https://github.com/google/brotli/commit/cc27fa8e20748ac0f2e9b6285188d4b94914420d) Python: Support streamed compression with the Compressor object ### 📊 Changes **2 files changed** (+135 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `python/_brotli.cc` (+133 -31) 📝 `python/brotli.py` (+2 -2) </details> ### 📄 Description 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_ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 20:52:21 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#1067