ZLIB(3)

πŸ“¦ version 1.2.8.2025.03.07, in nixos 26.05, nixpkgs unstable

πŸ’– ZLIB(3) β€” the libz manual, but make it make sense πŸ’–

okay besties, gather round, this is the libz page from the Library Functions Manual, and it's about to be your new hyperfixation. no cap. 🫢


✨ NAME ✨

libz β€” the compression/decompression library. that's it. that's the whole vibe. πŸ’…


✨ SYNOPSIS ✨

[see zlib.h for full description]

like the manpage itself is telling you to go read zlib.h. respect the honesty honestly. 😭


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so libz is a general purpose data compression library. general purpose!! it does it all, it's giving versatility, it's giving main character energy. ✨

the code is thread safe. yes bestie, thread safe, you can trust it. πŸ”₯

it gives you in-memory compression and decompression functions, including integrity checks of the uncompressed data. so it's not just smashing bytes around, it's actually checking its work. icon behavior. πŸ’œ

this version of the library supports only one compression method: deflation. just the one. one method, done immaculately. πŸ’…


compression can be done in a single step if the buffers are large enough β€” easy mode, slay. πŸ’–

or it can be done by repeated calls of the compression function. in that case youβ€”yes you, the applicationβ€”have to provide more input and/or consume the output (a.k.a. provide more output space) before each call. so like, it's a whole conversation with the library. iykyk. 🫢


the library also supports reading and writing files in gzip(1) (.gz) format with an interface similar to that of stdio. so if you know stdio, you already know the vibe here. 🌸


⚠️ heads up bestie: the library does not install any signal handler. none. zero. πŸ™ˆ

but like don't panic, because the decoder checks the consistency of the compressed data, so the library should never crash even in the case of corrupted input. she's resilient. she's been through things. πŸ’€βœ¨


All functions of the compression library are documented in the file zlib.h. every single one. go read it, i'll wait. πŸ“–


🌈 SEE ALSO 🌈

the Sortix zlib web site can be found at:

https://sortix.org/libz/

the data format used by the libz library is described by RFC (Request for Comments) 1950 to 1952 in the files:

http://tools.ietf.org/html/rfc1950 (for the zlib header and
trailer format)
http://tools.ietf.org/html/rfc1951 (for the deflate compressed
data format)
http://tools.ietf.org/html/rfc1952 (for the gzip header and
trailer format)

1950 = header/trailer, 1951 = deflate, 1952 = gzip. three RFCs, three vibes, one iconic library. πŸŽ€


Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available at:

http://marknelson.us/1997/01/01/zlib-engine/

history besties, we love to see it. πŸ‘‘


πŸ’€ REPORTING PROBLEMS πŸ’€

before reporting a problem, please check the libz web site to verify that you have the latest version of libz. otherwise, obtain the latest version and see if the problem still exists. like bestie, are you on the newest build or are you fighting ghosts. πŸ‘»

and please read the FAQ at the website before asking for help. do your reading first, then come ask. it's giving respect for everyone's time. 🫢


πŸ‘‘ AUTHORS πŸ‘‘

this is Sortix libz. this is not zlib. important distinction, don't @ me. πŸ’…

Sortix libz is based on the offical Zlib version 1.2.8 release. (yes, "offical" β€” that's how it's spelled in the original and i'm not about to edit the ancestors. 😭)


Zlib version 1.2.8 Copyright (C) 1995-2013 Jean-loup Gailly (jloup@gzip.org) and Mark Adler (madler@alumni.caltech.edu).


now the legal bits, and bestie these matter so read them fr fr:

this software is provided "as-is," without any express or implied warranty. in no event will the authors be held liable for any damages arising from the use of this software. see the distribution directory with respect to requirements governing redistribution. πŸ”₯

the deflate format used by zlib was defined by Phil Katz. the deflate and zlib specifications were written by L. Peter Deutsch. and thanks to all the people who reported problems and suggested various improvements in zlib β€” who are too numerous to cite here. legends, every one of them. 🌟


UNIX manual page by R. P. C. Rodgers, U.S. National Library of Medicine (rodgers@nlm.nih.gov); subsequently adapted by Sortix libz.


and that's the page! πŸŽ€ this one's dated 14 Aug 2014, from the ZLIB(3) manual β€” so go forth, compress responsibly, check your RFCs, and remember: thread safe, corruption tolerant, and absolutely not zlib. periodt. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from