Equivalent to gzinflate() function in PHP.

A

Adam Kubica

Hellou.

Anybody know about code that work equivalent to gzinflate()
function used in PHP?

I search via google but I don't found anything sensible :-(
 
K

kyosohma

Hellou.

Anybody know about code that work equivalent to gzinflate()
function used in PHP?

I search via google but I don't found anything sensible :-(

I'm not sure what gzinflate does, but it looks like it's some kind of
compression/decompression method. Python can do that. Check out the
following links:

http://www.python.org/doc/lib/module-gzip.html
http://www.python.org/doc/lib/module-zlib.html
http://python.active-venture.com/lib/module-bz2.html

Hopefully this is the type of thing you were looking for.

Mike
 
A

Adam Kubica

I'm not sure what gzinflate does, but it looks like it's some kind of
compression/decompression method. Python can do that. Check out the
following links:

http://www.python.org/doc/lib/module-gzip.html
http://www.python.org/doc/lib/module-zlib.html
http://python.active-venture.com/lib/module-bz2.html

Hopefully this is the type of thing you were looking for.

OK, but it isn't that I looking for :-(

gzinflate() is reversed function of gzdeflate(), zlib module allows to use
compress methon only, it's equivalent to gzcompress() in PHP.
 
A

Adam Kubica

OK, but it isn't that I looking for :-(

gzinflate() is reversed function of gzdeflate(), zlib module allows to use
compress methon only, it's equivalent to gzcompress() in PHP.

After some king of brain fucked tries, I found:

zlib.decompress( data ) #equivalent gzdecompress()
zlib.decompress( data, -zlib.MAX_WBITS ) #equivalent gzdeflate()

Thanks :)
 
L

Laurent Pointal

Adam Kubica a écrit :
After some king of brain fucked tries, I found:

zlib.decompress( data ) #equivalent gzdecompress()
zlib.decompress( data, -zlib.MAX_WBITS ) #equivalent gzdeflate()

Note: you can also use encode() and decode() methods on the string
containing your data, specifying 'zip' as encoding.

Example:
'HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHell
oHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHell
oHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHell
oHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHell
oHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHell
oHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHell
oHelloHelloHelloHello'


IMHO this is mode understandable than zlib.decompress( data,
-zlib.MAX_WBITS ).

A+

Laurent.

PS. There may be other compression encodings... look at
encodings.aliases.aliases, where I can see 'zip' and 'zlib' (same), but
also 'bz2'. - you can also found encoders for hexadecimal, quoted
printable, and other formats.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top