Python zlib.decompress(data)

0
zlib.decompress() method python

The zlib.decompress() method is used to decompress the bytes presents in data. It returns the bytes object that contains the uncompressed data. The zlib.decompress(data) takes certain parameters that specify how the data should be decompressed.

Example of zlib.decompress()

In the below example we have first compressed the bytes type data "alixaprodev.com" and then we have used the zlib.decompress() method to decompress the same data. The output of the code will be i) the compressed data and ii) the decompressed data.

import zlib
compressed_data= zlib.compress(b"alixaprodev.com")
print(compressed_data)

orignal_data=zlib.decompress(compressed_data)
print(orignal_data)

"wbits" parameter of zlib.decompress()

when the zlib.compress() method was used to compress the stram from a network, we were creating chunks. so the same is the case with the zlib.decompress() "wbits" parameter, it helps do decompress the chunks in the same way. The same value of the "wbits" should be used used to decompress the chunks that were used while in the compression.

Post a Comment

0Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.
Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !