Tcl
Tcl
Ungzip Base64 String
See more Gzip Examples
Suppose you have a gzip in base64 representation that contains a text file, such as XML. This example shows how to decompress and access the string.Chilkat Tcl Downloads
load ./chilkat.dll
set success 0
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set gzip [new_CkGzip]
set gzipBase64 "H4sIAAAAAAAE ... X6aZjXO3EwAA"
set bd [new_CkBinData]
set success [CkBinData_AppendEncoded $bd $gzipBase64 "base64"]
set success [CkGzip_UncompressBd $gzip $bd]
if {$success != 1} then {
puts [CkGzip_lastErrorText $gzip]
delete_CkGzip $gzip
delete_CkBinData $bd
exit
}
set strXml [CkBinData_getString $bd "utf-8"]
puts "XML:"
puts "$strXml"
delete_CkGzip $gzip
delete_CkBinData $bd