Python decompressing gzip chunk-by-chunk

后端 未结 2 1879
粉色の甜心
粉色の甜心 2020-11-29 04:42

I\'ve a memory- and disk-limited environment where I need to decompress the contents of a gzip file sent to me in string-based chunks (over xmlrpc binary transfer). However,

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-29 05:02

    I've got a more detailed answer here: https://stackoverflow.com/a/22310760/1733117

    d = zlib.decompressobj(zlib.MAX_WBITS|32)
    

    per documentation this automatically detects the header (zlib or gzip).

提交回复
热议问题