data -> gzip encoded data Encode data using the gzip content encoding as described in RFC 1952
(data)
| 1013 | # @return the encoded data |
| 1014 | |
| 1015 | def gzip_encode(data): |
| 1016 | """data -> gzip encoded data |
| 1017 | |
| 1018 | Encode data using the gzip content encoding as described in RFC 1952 |
| 1019 | """ |
| 1020 | if not gzip: |
| 1021 | raise NotImplementedError |
| 1022 | f = BytesIO() |
| 1023 | with gzip.GzipFile(mode="wb", fileobj=f, compresslevel=1) as gzf: |
| 1024 | gzf.write(data) |
| 1025 | return f.getvalue() |
| 1026 | |
| 1027 | ## |
| 1028 | # Decode a string using the gzip content encoding such as specified by the |
no test coverage detected
searching dependent graphs…