zlib.compress(string[, level])
level为压缩级别 1-9 级别越大压缩率越高但也越慢 默认为6
zlib.compressobj([level[, method[, wbits[, memlevel[, strategy]]]]])
返回一个Compress Object
method: 只可填入DEFLATED
memlevel: 1-9 级别越大 使用的内存量越大 但更快 默认为8
strategy: Z_DEFAULT_STRATEGY, Z_FILTERED, and Z_HUFFMAN_ONLY
wbits:The wbits argument controls the size of the history buffer (or the “window size”) used when compressing data, and whether a header and trailer is included in the output. It can take several ranges of values. The default is 15.
+9 to +15: The base-two logarithm of the window size, which therefore ranges between 512 and 32768. Larger values produce better compression at the expense of greater memory usage. The resulting output will include a zlib-specific header and trailer.
−9 to −15: Uses the absolute value of wbits as the window size logarithm, while producing a raw output stream with no header or trailing checksum.
+25 to +31 = 16 + (9 to 15): Uses the low 4 bits of the value as the window size logarithm, while including a basic gzip header and trailing checksum in the output.
zlib.crc32(data[, value])
zlib.decompress(string[, wbits[, bufsize]])
zlib.decompressobj([wbits])
Compress Object
compress(string)
flush([mode])
mode:Z_SYNC_FLUSH, Z_FULL_FLUSH, or Z_FINISH
默认为Z_FINISH,在调用之后不能再压缩
copy()
Decompress Object
Decompress.unused_data
Decompress.unconsumed_tail
网友评论