Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Zlib
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Refimprove|date=March 2021}}{{short description|DEFLATE codec library}} {{Lowercase title}} {{distinguish|Z-Library}} {{Infobox software | name = zlib | logo = [[Image:Zlib 3D green.svg|300px|zlib logo]] | released = {{Start date|1995|05|01|df=yes}} | latest release version = {{wikidata|property|reference|P348}} | latest release date = {{start date and age|{{wikidata|qualifier|P348|P577}}}} | programming language = [[C (programming language)|C]] | operating system = [[Cross-platform software|Cross-platform]] | genre = [[Data compression]] | license = [[zlib License]] | website = {{URL|zlib.net}} }} '''zlib''' ({{IPAc-en|'|z|i:|l|I|b}} or "[[zeta]]-lib", {{IPAc-en|'|z|i:|t|@|,|l|I|b}})<ref>{{Cite book|url=https://books.google.com/books?id=hwJQOwg-MGYC&q=zeta|title=The Linux Cookbook, 2nd Edition: Tips and Techniques for Everyday Use|first=Michael|last=Stutz|date=October 22, 2004|publisher=No Starch Press|isbn=9781593270315|via=Google Books|access-date=October 28, 2021|archive-date=January 25, 2023|archive-url=https://web.archive.org/web/20230125112610/https://books.google.com/books?id=hwJQOwg-MGYC&q=zeta|url-status=live}}</ref><ref>{{Cite book |last2=Hall |first2=John R. |url=https://books.google.com/books?id=7eAPUdU3hRUC&q=zlib+zeelib&pg=PA68 |title=Programming Linux Games |date=October 22, 2001 |publisher=No Starch Press |isbn=9781886411494 |via=Google Books |author1=Loki Software |access-date=October 28, 2021 |archive-date=July 11, 2024 |archive-url=https://web.archive.org/web/20240711145515/https://books.google.com/books?id=7eAPUdU3hRUC&q=zlib+zeelib&pg=PA68#v=snippet&q=zlib%20zeelib&f=false |url-status=live }}</ref> is a [[library (computing)|software library]] used for [[data compression]] as well as a data format.<ref name=RFC1950/> zlib was written by [[Jean-loup Gailly]]<!-- Person prefers lowercase l (ell), see his article --> and [[Mark Adler]] and is an [[abstraction (computer science)|abstraction]] of the [[DEFLATE]] compression algorithm used in their [[gzip]] file compression program. zlib is also a crucial component of many software platforms, including [[Linux]], [[macOS]], and [[iOS]]. It has also been used in gaming consoles such as the [[PlayStation 4]], [[PlayStation 3]], [[Wii U]], [[Wii]], [[Xbox One]] and [[Xbox 360]]. The first public version of Zlib, 0.9, was released on 1 May 1995 and was originally intended for use with the [[libpng]] image library. It is [[free software]], distributed under the [[zlib License]]. == Capabilities == === Encapsulation === Raw [[DEFLATE]] compressed data (RFC 1951)<ref>{{cite IETF |rfc=1951}}</ref> are typically written with a zlib or gzip wrapper encapsulating the data, by adding a header and footer. This provides stream identification and error detection that are not provided by the raw DEFLATE data. The zlib wrapper (RFC 1950)<ref name=RFC1950>{{cite IETF |rfc=1950}}</ref> is smaller than the gzip wrapper (RFC 1952),<ref>{{cite IETF |rfc=1952}}</ref> as the latter stores a file name and other file system information. === Algorithm === {{As of|2018|9}}, zlib only supports one algorithm, called [[DEFLATE]], which uses a combination of a variation of [[LZ77 and LZ78#LZ77|LZ77]] (Lempel–Ziv 1977) and [[Huffman coding]].<ref>{{cite IETF |rfc=1951}}</ref> This algorithm provides good compression on a wide variety of data with minimal use of system resources. This is also the algorithm used in the [[ZIP (file format)|Zip archive format]]. The header makes allowance for other algorithms, but none are currently implemented. === Resource use === zlib provides facilities for control of processor and memory use. A compression level value may be supplied that trades speed for compression. There are also facilities for conserving memory, useful in restricted memory environments, such as some embedded systems. === Strategy === The compression can be optimized for specific types of data. If one is using the library to always compress specific types of data, then using a specific strategy may improve compression and performance. For example, if the data contain long lengths of repeated bytes, the [[run-length encoding]] (RLE) strategy may give good results at a higher speed. For general data, the default strategy is preferred. === Error handling === Errors in compressed data may be detected and skipped. Further, if "full-flush" points are written to the compressed stream, then corrupt data can be skipped, and the decompression will resynchronize at the next flush point—although no error recovery of the corrupt data is provided. Full-flush points are useful for large data streams on unreliable channels, where some [[data loss]] is unimportant, such as in some multimedia applications. However, creating many flush points can affect the speed as well as the amount (ratio) of compression. === Data length === There is no limit to the length of data that can be compressed or decompressed. Repeated calls to the library allow an unlimited number of blocks of data to be handled. Some ancillary code (counters) may suffer from overflow for long data streams, but this does not affect the actual compression or decompression. When compressing a long (or infinite) data stream, it is advisable to write regular full-flush points. == Applications == Today, zlib is something of a ''[[de facto]]'' [[Standardization|standard]], to the point that zlib and DEFLATE are often used interchangeably in standards documents, with thousands of applications relying on it for compression, either directly or indirectly.<ref>{{Citation|title = zlib Applications|url = http://zlib.net/apps.html|date = 2002-04-18|first1 = Jean-loup|last1 = Gailly|first2 = Mark|last2 = Adler|access-date = 2007-12-09|archive-date = 2019-06-10|archive-url = https://web.archive.org/web/20190610212240/http://zlib.net/apps.html|url-status = live}}</ref> These include: * The [[Linux kernel]], where zlib is used to implement compressed network protocols, compressed [[file system]]s, and to decompress the kernel image at boot time. * [[GNU Binutils]] and [[GNU Debugger]] (GDB) * [[libpng]], the [[reference implementation]] for the [[PNG]] image format, which specifies DEFLATE as the stream compression for its [[bitmap]] data. * [[libwww]], an API for web applications like [[web browser]]s. * The [[Apache HTTP Server]], which uses zlib to implement [[HTTP compression|HTTP/1.1]]. * Similarly, the [[cURL]] library uses zlib to decompress HTTP responses.<ref>{{Cite web|url=https://stackoverflow.com/questions/26244134/why-does-curl-use-zlib|title=c++ - Why does cURL use zlib?|website=Stack Overflow}}</ref> * The [[OpenSSH]] client and server, which rely on zlib to perform the optional compression offered by the [[Secure Shell]] protocol. * The [[OpenSSL]] and [[GnuTLS]] security libraries, which can optionally use zlib to compress [[Transport Layer Security|TLS]] connections. * The [[FFmpeg]] multimedia library, which uses zlib to read and write the DEFLATE-compressed parts of [[Digital container format|stream formats]], such as [[Matroska]]. * The [[rsync]] remote file synchronizer, which uses zlib to implement optional protocol compression. * The [[dpkg]] and [[RPM Package Manager|RPM]] [[package manager]]s, which use zlib to unpack files from compressed software packages. * The [[Apache Subversion]] and [[Concurrent Versions System|CVS]] [[version control]] systems, which use zlib to compress traffic to and from remote repositories. * The [[Apache ORC]] column-oriented data storage format use ZLib as its default compression method.<ref>{{cite web | url=https://blog.cloudera.com/orcfile-in-hdp-2-better-compression-better-performance/ | title=ORCFile in HDP 2: Better Compression, Better Performance | date=6 September 2013 | access-date=16 May 2020 | archive-date=6 August 2020 | archive-url=https://web.archive.org/web/20200806094918/https://blog.cloudera.com/orcfile-in-hdp-2-better-compression-better-performance/ | url-status=live }}</ref> * The [[Git]] [[version control]] system uses zlib to store the contents of its data objects (blobs, trees, commits and tags). * The [[PostgreSQL]] [[Relational database#RDBMS|RDBMS]] uses zlib with custom dump format (pg_dump -Fc) for database backups. * The class System.IO.Compression.DeflateStream of the Microsoft [[.NET Framework]] 2.0 and higher.<ref>[http://msdn.microsoft.com/en-us/library/system.io.compression.deflatestream(v=vs.110).aspx System.IO.Compression.DeflateStream] {{Webarchive|url=https://web.archive.org/web/20160206034021/http://msdn.microsoft.com/en-us/library/system.io.compression.deflatestream(v=vs.110).aspx |date=2016-02-06 }}. MSDN Library.</ref> * The "deflate" utility in TORNADO as part of [[VxWorks]] Operating System made by [[Wind River Systems]] uses zlib to compress boot ROM images. * zlib-flate,<ref>{{man|1|zlib-flate|Debian}}</ref> raw zlib compression program, part of qpdf<ref>{{Cite web |url=https://packages.debian.org/sid/amd64/qpdf/filelist |title=qpdf |access-date=2021-03-28 |archive-date=2024-07-11 |archive-url=https://web.archive.org/web/20240711145517/https://packages.debian.org/sid/amd64/qpdf/filelist |url-status=live }}</ref> * The [[MySQL]] [[Relational database#RDBMS|RDBMS]] uses ZLib LZ77 for compression in [[InnoDB]] Tables <ref>{{Cite web|url=https://dev.mysql.com/doc/refman/8.0/en/innodb-compression-internals.html|title=MySQL :: MySQL 8.0 Reference Manual :: 15.9.1.5 How Compression Works for InnoDB Tables|website=dev.mysql.com|access-date=2021-07-14|archive-date=2021-08-01|archive-url=https://web.archive.org/web/20210801181906/https://dev.mysql.com/doc/refman/8.0/en/innodb-compression-internals.html|url-status=live}}</ref> <!-- Please do not add file formats to this list; it is for *software* relying on zlib. --> zlib is also used in many embedded devices, such as the Apple [[iPhone]] and Sony [[PlayStation 3]], because the code is portable, liberally licensed, and has a relatively small [[memory footprint]]. === Forks === A commonly used library built on an old codebase, zlib is also frequently [[Fork (software development)|forked]] by third-parties that claim improvements to this library: * [[Intel]] has a high-performance fork of zlib.<ref>{{cite web |title=github Intel ZLIB |url=https://github.com/intel/zlib |website=github |access-date=25 January 2024 |language=en |date=25 January 2024 |archive-date=25 January 2024 |archive-url=https://web.archive.org/web/20240125130250/https://github.com/intel/zlib |url-status=live }}</ref> * [[Cloudflare]] maintains a high-performance fork with "massive" improvements.<ref>{{cite web |title=Fighting Cancer: The Unexpected Benefit Of Open Sourcing Our Code |url=https://blog.cloudflare.com/cloudflare-fights-cancer/ |website=The Cloudflare Blog |language=en |date=8 July 2015 |access-date=18 January 2020 |archive-date=21 September 2019 |archive-url=https://web.archive.org/web/20190921164235/https://blog.cloudflare.com/cloudflare-fights-cancer/ |url-status=live }}</ref> * zlib-ng is a zlib replacement fork for "next generation" systems. It removes workaround code for compilers that do not support [[ANSI C]], integrates Cloudflare and Intel optimizations, adds [[hardware acceleration]] ([[SIMD]] and [[intrinsic function]]s), and uses [[code sanitizer]]s, [[fuzzing]], and [[code coverage]] to help find bugs.<ref>{{cite web |last1=Rosbach |first1=HK |title=zlib-ng/zlib-ng: zlib replacement with optimizations for "next generation" systems. |url=https://github.com/zlib-ng/zlib-ng |website=GitHub |publisher=zlib-ng |date=24 February 2023 |access-date=18 January 2020 |archive-date=20 April 2020 |archive-url=https://web.archive.org/web/20200420024701/https://github.com/zlib-ng/zlib-ng |url-status=live }}</ref> == See also == {{Portal|Free and open-source software}} * [[DEFLATE]] * [[gzip]] * [[LZ77 and LZ78#LZ77|LZ77 and LZ78 § LZ77]] * [[Zip (file format)]] * [[zlib License]] * [[Zopfli]] * [[List of archive formats]] == References == {{Reflist|30em}} == External links == <!-- ======================== {{No more links}} ======================== | PLEASE BE CAUTIOUS IN ADDING MORE LINKS TO THIS ARTICLE. Wikipedia | | is not a collection of links, nor should it be used for advertising. | | | | Excessive or inappropriate links WILL BE DELETED. | | See [[Wikipedia:External links]] & [[Wikipedia:Spam]] for details. | | | | If there are already plentiful links, please propose additions or | | replacements on this article's discussion page, or submit your link | | to the relevant category at the Open Directory Project (dmoz.org) | | and link back to that category using the {{Curlie}} template. | ======================= {{No more links}} ============================ --> * {{Official website|//zlib.net}} <!-- Categories --> [[Category:1995 software]] [[Category:C (programming language) libraries]] [[Category:Free computer libraries]] [[Category:Free data compression software]] [[Category:Free software programmed in C]] [[Category:Software using the zlib license]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:As of
(
edit
)
Template:Citation
(
edit
)
Template:Cite IETF
(
edit
)
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Distinguish
(
edit
)
Template:IPAc-en
(
edit
)
Template:Infobox
(
edit
)
Template:Infobox software
(
edit
)
Template:Lowercase title
(
edit
)
Template:Main other
(
edit
)
Template:Man
(
edit
)
Template:Official website
(
edit
)
Template:Portal
(
edit
)
Template:Refimprove
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Template other
(
edit
)
Template:Webarchive
(
edit
)