(content: bytes)
| 160 | |
| 161 | |
| 162 | def encode_gzip(content: bytes) -> bytes: |
| 163 | s = BytesIO() |
| 164 | # set mtime to 0 so that gzip encoding is deterministic. |
| 165 | # Use compresslevel=1 for fastest compression speed. |
| 166 | with gzip.GzipFile(fileobj=s, mode="wb", mtime=0, compresslevel=1) as f: |
| 167 | f.write(content) |
| 168 | return s.getvalue() |
| 169 | |
| 170 | |
| 171 | def decode_brotli(content: bytes) -> bytes: |