Sample code for 30+ languages & platforms
VBScript

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 VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

set gzip = CreateObject("Chilkat.Gzip")

gzipBase64 = "H4sIAAAAAAAE ... X6aZjXO3EwAA"

set bd = CreateObject("Chilkat.BinData")
success = bd.AppendEncoded(gzipBase64,"base64")

success = gzip.UncompressBd(bd)
If (success <> 1) Then
    outFile.WriteLine(gzip.LastErrorText)
    WScript.Quit
End If

strXml = bd.GetString("utf-8")
outFile.WriteLine("XML:")
outFile.WriteLine(strXml)

outFile.Close