Skip to content

Instantly share code, notes, and snippets.

@celophi
Created July 31, 2017 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save celophi/26e422abc3b9c6a9e0082cfe03474243 to your computer and use it in GitHub Desktop.
Save celophi/26e422abc3b9c6a9e0082cfe03474243 to your computer and use it in GitHub Desktop.
function Expand-Bytes {
param (
[Parameter(
Mandatory=$true,
ValueFromPipeline=$true)]
$bytes
)
$outstream = New-Object System.IO.MemoryStream
$ms = [System.IO.MemoryStream]::New($bytes)
$ds = [System.IO.Compression.DeflateStream]::New($ms, [System.IO.Compression.CompressionMode]::Decompress)
$ds.CopyTo($outstream)
$result = $outstream.ToArray()
Write-Host (($result | % { "{0:X2}" -f $_ }) -join " ")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment