zlib.compress(string[, level])
level為壓縮級別 1-9 級別越大壓縮率越高但也越慢 默認(rèn)為6
zlib.compressobj([level[, method[, wbits[, memlevel[, strategy]]]]])
返回一個Compress Object
method: 只可填入DEFLATED
memlevel: 1-9 級別越大 使用的內(nèi)存量越大 但更快 默認(rèn)為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
默認(rèn)為Z_FINISH,在調(diào)用之后不能再壓縮
copy()
Decompress Object
Decompress.unused_data
Decompress.unconsumed_tail