Decompress truncated files #240

Closed
opened 2026-01-29 20:40:31 +00:00 by claunia · 2 comments
Owner

Originally created by @espoal on GitHub (Jun 24, 2018).

Mine might be an edge case, but I need to decompress truncated files.

I'm testing http2 chunked responses, with precompressed files.

Currently, with gzip I calculate optimal truncation points by trial and error, trying several combinations until I find the best one.

With Brotli I can't do it from the command line and thus I can't automate it. From the browser it works, though.

reproduction:

brotli input.txt && truncate -s700 input.txt.br && brotli -d input.txt.br

Originally created by @espoal on GitHub (Jun 24, 2018). Mine might be an edge case, but I need to decompress truncated files. I'm testing http2 chunked responses, with precompressed files. Currently, with gzip I calculate optimal truncation points by trial and error, trying several combinations until I find the best one. With Brotli I can't do it from the command line and thus I can't automate it. From the browser it works, though. reproduction: `brotli input.txt && truncate -s700 input.txt.br && brotli -d input.txt.br`
Author
Owner

@eustas commented on GitHub (Jun 26, 2018):

Hello.

Could you elaborate, please? What are "optimal" truncation points?

Brotli decoder is built in a way to decode all the input bytes it has been provided so far. Every "flush" will add overhead, and is only useful for dynamic packaged networking, where it is important to give guarantees that all the encoded bytes will be decoded on the other size (i.e. nothing is "buffered")...

@eustas commented on GitHub (Jun 26, 2018): Hello. Could you elaborate, please? What are "optimal" truncation points? Brotli decoder is built in a way to decode all the input bytes it has been provided so far. Every "flush" will add overhead, and is only useful for dynamic packaged networking, where it is important to give guarantees that all the encoded bytes will be decoded on the other size (i.e. nothing is "buffered")...
Author
Owner

@eustas commented on GitHub (Oct 22, 2018):

You could use Python wrapper. It's API is close to C API, but allows quick experiments.

@eustas commented on GitHub (Oct 22, 2018): You could use Python wrapper. It's API is close to C API, but allows quick experiments.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#240