Lua
Lua
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 Lua Downloads
local chilkat = require("chilkat")
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
local gzip = chilkat.Gzip.new()
local gzipBase64 = "H4sIAAAAAAAE ... X6aZjXO3EwAA"
local bd = chilkat.BinData.new()
local success = bd:append_encoded(gzipBase64, "base64")
success = gzip:uncompress_bd(bd)
if not success then
print(gzip.last_error_text)
return
end
local strXml = bd:get_string("utf-8")
print("XML:")
print(strXml)