(PowerShell) Decompress Bytes
Demonstrates how to decompress binary data.
Add-Type -Path "C:\chilkat\ChilkatDotNet47-9.5.0-x64\ChilkatDotNet47.dll"
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
# See this example to compress bytes: Compress Bytes
$fac = New-Object Chilkat.FileAccess
$compressedBytes = $fac.ReadEntireFile("qa_data/compressed/compressedBmp.dat")
if ($fac.LastMethodSuccess -ne $true) {
$($fac.LastErrorText)
exit
}
$compress = New-Object Chilkat.Compression
$compress.Algorithm = "deflate"
$decompressedBytes = $compress.DecompressBytes($compressedBytes)
if ($compress.LastMethodSuccess -ne $true) {
$($compress.LastErrorText)
exit
}
$success = $fac.WriteEntireFile("qa_output/decompressed.bmp",$decompressedBytes)
if ($fac.LastMethodSuccess -ne $true) {
$($fac.LastErrorText)
exit
}
|