Hi Folks,
I've been digging around the documentation trying to find an answer, without any success, so I am hoping someone here can lend their expertise. I need to uncompress some zlib compressed data in a container. I've tried using the decompress function, but I get an error about the data not being compressed. It is my understanding that the decompress function is meant to work on gzipped data, and that although both gzip and zlib use the same compressed data format, they have different
trailers and headers around the data (see RFC's 1950, 1951, and 1952), but I am certainly no expert on compression formats.
I am hoping someone here can clarify if decompress is supposed to also works with zlib compressed data, or if there is another way to do this in LiveCode.
Any help would be much appreciated.
Thanks,
Daryl
Inflating zlib compresed data
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Inflating zlib compresed data
What platform? Zip and gzip have various different methods they can use to compress data, and I think the built-in compress and decompress methods use just one.
If the revZipXXX functions don't do what you want, you can always resort to what I do in this situation: just use the shell command
If the revZipXXX functions don't do what you want, you can always resort to what I do in this situation: just use the shell command
Code: Select all
ask file "Find the zipped file"
if it is not empty then
put it into tPathToFile
put shell("unzip" && tPathToFile) into tResult
if tResult is not empty then
answer tResult
end if
end if
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: Inflating zlib compresed data
Also note that if your zipped file contains a directory structure, the built-in commands won't unzip it properly - you have to use shell in that case.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: Inflating zlib compresed data
Hi mwieder,
Thanks for your reply I will have to look into the revZipXXX functions, and thanks for the shell code example, I was starting to think I might have to do something like that, but wasn't sure how it's done in LiveCode. Hopefully the revZip functions will have what I need. Thanks again.
Regards,
Daryl
Thanks for your reply I will have to look into the revZipXXX functions, and thanks for the shell code example, I was starting to think I might have to do something like that, but wasn't sure how it's done in LiveCode. Hopefully the revZip functions will have what I need. Thanks again.
Regards,
Daryl