It is also possible to decompress it using standard shell-script + gzip, if you don't have, or want to use openssl or other tools.
The trick is to prepend the gzip magic number and compress method to the actual data from zlib.compress:

printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" |cat - /tmp/data |gzip -dc >/tmp/out

Edits:
@d0sboots commented: For RAW Deflate data, you need to add 2 more null bytes:
โ†’ "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x00"

This Q on SO gives more information about this approach. An answer there suggests that there is also an 8 byte footer.

Users @Vitali-Kushner and @mark-bessey reported success even with truncated files, so a gzip footer does not seem strictly required.

@tobias-kienzler suggested this function for the bashrc:
zlibd() (printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" | cat - "$@" | gzip -dc)

Answer from wkpark on Stack Exchange
๐ŸŒ
Ubuntu
manpages.ubuntu.com โ€บ focal โ€บ man(3)
Ubuntu Manpage: zlib - compression and decompression operations
The transformation can be removed again with chan pop. The mode argument determines what type of transformation is pushed; the following are supported: ... The transformation will be a compressing transformation that produces zlib-format data on channel, which must be writable.
Discussions

Zlib uncompression for an noob

Looks like zlib compressed data, here's more info how to deflate it: https://unix.stackexchange.com/questions/22834/how-to-uncompress-zlib-data-in-unix

More on reddit.com
๐ŸŒ r/LiveOverflow
5
6
March 27, 2020
Zlib uncompression for an idiot? | MajorGeeks.Com Support Forums
I want to uncompress a ZLIB-compressed file, without any programming skill. Could some of you give me exact help? More on forums.majorgeeks.com
๐ŸŒ forums.majorgeeks.com
September 25, 2010
red lang - How to decompress/deflate zlib data [rfc1951]? - Stack Overflow
I am looking for decompressing data according to the deflate compression mechanism [rfc1951]. The linux command for this mechanism is: zlib-flate -uncompress I try the Red command decompress with More on stackoverflow.com
๐ŸŒ stackoverflow.com
uncompress of zlib
When I gzopen & gzread from a gzip file, it works OK. But I when I try to uncompress the same data from memory (either by reading to memory with fread or mmap()ing) using decompress, I get Z_DATA_ERROR. Is it because gzip file has some kind of headers that uncompress doesn't want? More on unix.com
๐ŸŒ unix.com
3
0
October 20, 2017
๐ŸŒ
GitHub
github.com โ€บ kevin-cantwell โ€บ zlib
GitHub - kevin-cantwell/zlib: A command-line utility for quickly compressing or decompressing zlib data. ยท GitHub
Without any arguments, zlib will compress an input stream. Use the -d flag for decompression.
Starred by 48 users
Forked by 4 users
Languages ย  Go
๐ŸŒ
SysTutorials
systutorials.com โ€บ docs โ€บ linux โ€บ man โ€บ n-zlib
zlib: compression and decompression operations - Linux Manuals (n)
Pushes a compressing or decompressing transformation onto the channel channel. The transformation can be removed again with chan pop. The mode argument determines what type of transformation is pushed; the following are supported: ... The ...
๐ŸŒ
Linux Man Pages
linux.die.net โ€บ man โ€บ 3 โ€บ zlib
zlib(3): compression/decompression library - Linux man page
The zlib library is a general purpose data compression library. The code is thread safe. It provides in-memory compression and decompression functions, including integrity checks of the uncompressed data.
๐ŸŒ
Jyotiprakash's Blog
blog.jyotiprakash.org โ€บ file-compression-and-decompression-in-c-using-zlib
File compression and decompression in C using ZLib
December 31, 2023 - It takes three arguments: the input filename, the operation ('compress' or 'decompress'), and the output filename. ... Use the -lz flag to link against Zlib.
๐ŸŒ
Code Beautify
codebeautify.org โ€บ zlib-decompress-online
Zlib Decompress Online to Zlib Decode Text
Zlib to Decompress Online works well on Windows, MAC, Linux, Chrome, Firefox, Edge, and Safari.
Find elsewhere
๐ŸŒ
MajorGeeks
forums.majorgeeks.com โ€บ threads โ€บ zlib-uncompression-for-an-idiot.223640
Zlib uncompression for an idiot? | MajorGeeks.Com Support Forums
September 25, 2010 - I want to uncompress a ZLIB-compressed file, without any programming skill. Could some of you give me exact help?
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 69105129 โ€บ how-to-decompress-deflate-zlib-data-rfc1951
red lang - How to decompress/deflate zlib data [rfc1951]? - Stack Overflow
I am looking for decompressing data according to the deflate compression mechanism [rfc1951]. The linux command for this mechanism is: zlib-flate -uncompress I try the Red command decompress with
๐ŸŒ
Linuxbase
refspecs.linuxbase.org โ€บ LSB_3.0.0 โ€บ LSB-Core-generic โ€บ LSB-Core-generic โ€บ zlib-uncompress-1.html
uncompress - Linux Foundation Referenced Specifications
int uncompress(Bytef * dest, uLongf * destLen, const Bytef * source, uLong sourceLen); ยท The uncompress() function shall attempt to uncompress sourceLen bytes of data in the buffer source, placing the result in the buffer dest
๐ŸŒ
YouTube
youtube.com โ€บ peter schneider
How to uncompress zlib data in UNIX? - YouTube
How to uncompress zlib data in UNIX?I hope you found a solution that worked for you :) The Content (except music & images) is licensed under (https://meta.st...
Published ย  December 6, 2022
Views ย  826
๐ŸŒ
SysTutorials
systutorials.com โ€บ docs โ€บ linux โ€บ man โ€บ 1-zlib_decompress
zlib_decompress: decompress mysqlpump ZLIB-compressed output - Linux Manuals (1)
The zlib_decompress utility decompresses mysqlpump output that was created using ZLIB compression. Note If MySQL was configured with the -DWITH_ZLIB=system option,
๐ŸŒ
Unix.com
unix.com โ€บ applications โ€บ programming
uncompress of zlib - Programming - Unix Linux Community
October 20, 2017 - When I gzopen & gzread from a gzip file, it works OK. But I when I try to uncompress the same data from memory (either by reading to memory with fread or mmap()ing) using decompress, I get Z_DATA_ERROR. Is it because gziโ€ฆ
๐ŸŒ
Arch Linux Man Pages
man.archlinux.org โ€บ man โ€บ extra โ€บ qpdf โ€บ zlib-flate.1.en
zlib-flate(1) โ€” Arch manual pages
The zlib-flate program reads from standard input and writes to standard output either compressing or uncompressing its input using raw zlib compression. It can be used to uncompress or compress raw PDF streams or other data that is compressed with raw zlib compression.
๐ŸŒ
zlib
zlib.net โ€บ zlib_how.html
zlib Usage Example
February 12, 2026 - /* decompress until deflate stream ends or end of file */ do { We read input data and set the strm structure accordingly. If we've reached the end of the input file, then we leave the outer loop and report an error, since the compressed data is incomplete. Note that we may read more data than is eventually consumed by inflate(), if the input file continues past the zlib stream.
๐ŸŒ
GitHub
gist.github.com โ€บ arq5x โ€บ 5315739
Compress and then Decompress a string with zlib. ยท GitHub - Gist
deflateInit(&defstream, Z_BEST_COMPRESSION); deflate(&defstream, Z_FINISH); deflateEnd(&defstream); // This is one way of getting the size of the output printf("Compressed size is: %lu\n", strlen(b)); printf("Compressed string is: %s\n", b); ...