(x-plat) Memory-based gzip compression
(content: t.BinaryIO)
| 84 | |
| 85 | |
| 86 | def inmemory_compress(content: t.BinaryIO) -> t.BinaryIO: |
| 87 | """(x-plat) Memory-based gzip compression""" |
| 88 | content.seek(0) |
| 89 | zbuf = io.BytesIO() |
| 90 | with gzip.GzipFile(mode="wb", fileobj=zbuf, mtime=0.0) as zfile: |
| 91 | zfile.write(content.read()) |
| 92 | zbuf.seek(0) |
| 93 | return zbuf |
| 94 | |
| 95 | |
| 96 | @contextmanager |