Created
April 13, 2021 18:20
-
-
Save jevinskie/93fa312c61ab2bef0a0afa9f8cd268e8 to your computer and use it in GitHub Desktop.
raw zlib/deflate compress/decompress shell functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function unzlib { | |
exec 9<&0 | |
printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" | cat - ${1:-/dev/fd/9} | gzip -dc | |
} | |
function zlib { | |
cat ${1:-/dev/stdin} | gzip -c | tail -c +9 | |
} | |
function undeflate { | |
exec 9<&0 | |
printf "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x00" | cat - ${1:-/dev/fd/9} | gzip -dc | |
} | |
function deflate { | |
cat ${1:-/dev/stdin} | gzip -c | tail -c +11 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment