Sample code for 30+ languages & platforms
PowerShell

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

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

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

$gzip = New-Object Chilkat.Gzip

$gzipBase64 = "H4sIAAAAAAAE ... X6aZjXO3EwAA"

$bd = New-Object Chilkat.BinData
$success = $bd.AppendEncoded($gzipBase64,"base64")

$success = $gzip.UncompressBd($bd)
if ($success -ne $true) {
    $($gzip.LastErrorText)
    exit
}

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