Compress::Zlib(3)

πŸ“¦ version 2.220.0, in opensuse-leap 16.0

πŸŽ€ Compress::Zlib(3) β€” User Contributed Perl Documentation πŸŽ€

okay bestie, welcome to the Compress::Zlib(3) page πŸ’– this is the one that explains the Perl interface to zlib, and we're gonna keep every single detail cute and intact. no cap.

🌸 NAME 🌸

Compress::Zlib β€” literally the interface to the zlib compression library. periodt.

✨ SYNOPSIS ✨

here's the whole vibe in code form, exactly as written:

    use Compress::Zlib ;

    ($d, $status) = deflateInit( [OPT] ) ;
    $status = $d->deflate($input, $output) ;
    $status = $d->flush([$flush_type]) ;
    $d->deflateParams(OPTS) ;
    $d->deflateTune(OPTS) ;
    $d->dict_adler() ;
    $d->crc32() ;
    $d->adler32() ;
    $d->total_in() ;
    $d->total_out() ;
    $d->msg() ;
    $d->get_Strategy();
    $d->get_Level();
    $d->get_BufSize();

    ($i, $status) = inflateInit( [OPT] ) ;
    $status = $i->inflate($input, $output [, $eof]) ;
    $status = $i->inflateSync($input) ;
    $i->dict_adler() ;
    $d->crc32() ;
    $d->adler32() ;
    $i->total_in() ;
    $i->total_out() ;
    $i->msg() ;
    $d->get_BufSize();

    $dest = compress($source) ;
    $dest = uncompress($source) ;

    $gz = gzopen($filename or filehandle, $mode) ;
    $bytesread = $gz->gzread($buffer [,$size]) ;
    $bytesread = $gz->gzreadline($line) ;
    $byteswritten = $gz->gzwrite($buffer) ;
    $status = $gz->gzflush($flush) ;
    $offset = $gz->gztell() ;
    $status = $gz->gzseek($offset, $whence) ;
    $status = $gz->gzclose() ;
    $status = $gz->gzeof() ;
    $status = $gz->gzsetparams($level, $strategy) ;
    $errstring = $gz->gzerror() ;
    $gzerrno

    $dest = Compress::Zlib::memGzip($buffer) ;
    $dest = Compress::Zlib::memGunzip($buffer) ;

    $crc = adler32($buffer [,$crc]) ;
    $crc = crc32($buffer [,$crc]) ;

    $crc = crc32_combine($crc1, $crc2, $len2);
    $adler = adler32_combine($adler1, $adler2, $len2);

    my $version = Compress::Raw::Zlib::zlib_version();

πŸ’… DESCRIPTION πŸ’…

The Compress::Zlib module provides a Perl interface to the zlib compression library β€” peep "AUTHOR" for details about where to get zlib, bestie 🫢

The Compress::Zlib module can be split into two general areas of functionality, namely a simple read/write interface to gzip files and a low-level in-memory compression/decompression interface.

Each of these areas will be discussed in the following sections.

πŸ¦‹ Notes for users of Compress::Zlib version 1 πŸ¦‹

The main change in Compress::Zlib version 2.x is that it does not now interface directly to the zlib library. Instead it uses the IO::Compress::Gzip and IO::Uncompress::Gunzip modules for reading/writing gzip files, and the Compress::Raw::Zlib module for some low-level zlib access.

The interface provided by version 2 of this module should be 100% backward compatible with version 1. If you find a difference in the expected behaviour please contact the author (See "AUTHOR"). See "GZIP INTERFACE"

With the creation of the IO::Compress and IO::Uncompress modules no new features are planned for Compress::Zlib β€” the new modules do everything that Compress::Zlib does and then some. Development on Compress::Zlib will be limited to bug fixes only.

If you are writing new code, your first port of call should be one of the new IO::Compress or IO::Uncompress modules. slay πŸ’…

🌈 GZIP INTERFACE 🌈

A number of functions are supplied in zlib for reading and writing gzip files that conform to RFC 1952. This module provides an interface to most of them.

If you have previously used Compress::Zlib 1.x, the following enhancements/changes have been made to the gzopen interface:

  1. If you want to open either STDIN or STDOUT with gzopen, you can now optionally use the special filename "-" as a synonym for \*STDIN and \*STDOUT.
  2. In Compress::Zlib version 1.x, gzopen used the zlib library to open the underlying file. This made things especially tricky when a Perl filehandle was passed to gzopen. Behind the scenes the numeric C file descriptor had to be extracted from the Perl filehandle and this passed to the zlib library.

Apart from being non-portable to some operating systems, this made it difficult to use gzopen in situations where you wanted to extract/create a gzip data stream that is embedded in a larger file, without having to resort to opening and closing the file multiple times.

It also made it impossible to pass a perl filehandle that wasn't associated with a real filesystem file, like, say, an IO::String.

In Compress::Zlib version 2.x, the gzopen interface has been completely rewritten to use the IO::Compress::Gzip for writing gzip files and IO::Uncompress::Gunzip for reading gzip files. None of the limitations mentioned above apply.

  1. Addition of gzseek to provide a restricted seek interface.
  2. Added gztell.

A more complete and flexible interface for reading/writing gzip files/buffers is included with the module IO-Compress-Zlib. See IO::Compress::Gzip and IO::Uncompress::Gunzip for more details.


🫢 $gz = gzopen($filename, $mode) / $gz = gzopen($filehandle, $mode) 🫢

This function opens either the gzip file $filename for reading or writing or attaches to the opened filehandle, $filehandle. It returns an object on success and undef on failure.

When writing a gzip file this interface will always create the smallest possible gzip header (exactly 10 bytes). If you want greater control over what gets stored in the gzip header (like the original filename or a comment) use IO::Compress::Gzip instead. Similarly if you want to read the contents of the gzip header use IO::Uncompress::Gunzip.

The second parameter, $mode, is used to specify whether the file is opened for reading or writing and to optionally specify a compression level and compression strategy when writing. The format of the $mode parameter is similar to the mode parameter to the 'C' function fopen, so rb is used to open for reading, wb for writing and ab for appending (writing at the end of the file).

To specify a compression level when writing, append a digit between 0 and 9 to the mode string -- 0 means no compression and 9 means maximum compression. If no compression level is specified Z_DEFAULT_COMPRESSION is used.

To specify the compression strategy when writing, append 'f' for filtered data, 'h' for Huffman only compression, or 'R' for run-length encoding. If no strategy is specified Z_DEFAULT_STRATEGY is used.

So, for example, wb9 means open for writing with the maximum compression using the default strategy and wb4R means open for writing with compression level 4 and run-length encoding.

Refer to the zlib documentation for the exact format of the $mode parameter.

πŸ“ $bytesread = $gz->gzread($buffer [, $size]) ; πŸ“

Reads $size bytes from the compressed file into $buffer. If $size is not specified, it will default to 4096. If the scalar $buffer is not large enough, it will be extended automatically.

Returns the number of bytes actually read. On EOF it returns 0 and in the case of an error, -1.

🌸 $bytesread = $gz->gzreadline($line) ; 🌸

Reads the next line from the compressed file into $line.

Returns the number of bytes actually read. On EOF it returns 0 and in the case of an error, -1.

It is legal to intermix calls to gzread and gzreadline.

To maintain backward compatibility with version 1.x of this module gzreadline ignores the $/ variable β€” it always uses the string "\n" as the line delimiter.

If you want to read a gzip file a line at a time and have it respect the $/ variable (or $INPUT_RECORD_SEPARATOR, or $RS when English is in use) see IO::Uncompress::Gunzip.

πŸ¦‹ $byteswritten = $gz->gzwrite($buffer) ; πŸ¦‹

Writes the contents of $buffer to the compressed file. Returns the number of bytes actually written, or 0 on error.

πŸ’œ $status = $gz->gzflush($flush_type) ; πŸ’œ

Flushes all pending output into the compressed file.

This method takes an optional parameter, $flush_type, that controls how the flushing will be carried out. By default the $flush_type used is Z_FINISH. Other valid values for $flush_type are Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FULL_FLUSH and Z_BLOCK. It is strongly recommended that you only set the flush_type parameter if you fully understand the implications of what it does β€” overuse of flush can seriously degrade the level of compression achieved. See the zlib documentation for details.

Returns 0 on success.

⭐ $offset = $gz->gztell() ; ⭐

Returns the uncompressed file offset.

πŸ”₯ $status = $gz->gzseek($offset, $whence) ; πŸ”₯

Provides a sub-set of the seek functionality, with the restriction that it is only legal to seek forward in the compressed file.

bestie warning: it is a fatal error to attempt to seek backward 😭

When opened for writing, empty parts of the file will have NULL (0x00) bytes written to them.

The $whence parameter should be one of SEEK_SET, SEEK_CUR or SEEK_END.

Returns 1 on success, 0 on failure.

πŸŽ€ $gz->gzclose πŸŽ€

Closes the compressed file. Any pending data is flushed to the file before it is closed.

Returns 0 on success.

πŸ‘‘ $gz->gzsetparams($level, $strategy πŸ‘‘

Change settings for the deflate stream $gz.

The list of the valid options is shown below. Options not specified will remain unchanged.

note bestie: This method is only available if you are running zlib 1.0.6 or better.
  • $level β€” Defines the compression level. Valid values are 0 through 9, Z_NO_COMPRESSION, Z_BEST_SPEED, Z_BEST_COMPRESSION, and Z_DEFAULT_COMPRESSION.
  • $strategy β€” Defines the strategy used to tune the compression. The valid values are Z_DEFAULT_STRATEGY, Z_FILTERED and Z_HUFFMAN_ONLY.

πŸ’€ $gz->gzerror πŸ’€

Returns the zlib error message or number for the last operation associated with $gz. The return value will be the zlib error number when used in a numeric context and the zlib error message when used in a string context. The zlib error number constants, shown below, are available for use.

    Z_OK
    Z_STREAM_END
    Z_ERRNO
    Z_STREAM_ERROR
    Z_DATA_ERROR
    Z_MEM_ERROR
    Z_BUF_ERROR

🧚 $gzerrno 🧚

The $gzerrno scalar holds the error code associated with the most recent gzip routine. Note that unlike gzerror(), the error is not associated with a particular file.

Like, same energy as gzerror() β€” it hands you an error number when you're being all numeric about it, and an error message when you're in string context. But here's the twist πŸ™ˆ unlike gzerror(), the message it gives you matches the zlib message when the error is actually a zlib thing, or the UNIX error message when it isn't (like, when zlib itself returned "Z_ERRORNO").

Big brain warning though 🧠✨ zlib and UNIX error numbers overlap, so $gzerrno should only be used to check whether an error exists at all when you're in numeric context. If you want to check for a specific zlib error, use gzerror(). The gzcat example down below shows you the safe way to use this variable, iykyk πŸ’…

Examples πŸŽ€

Okay so here's a script that actually uses the interface β€” it gives you a gzcat function. Iconic behavior honestly:

use strict ;
use warnings ;

use Compress::Zlib ;

# use stdin if no files supplied
@ARGV = '-' unless @ARGV ;

foreach my $file (@ARGV) {
    my $buffer ;

    my $gz = gzopen($file, "rb")
         or die "Cannot open $file: $gzerrno\n" ;

    print $buffer while $gz->gzread($buffer) > 0 ;

    die "Error reading from $file: $gzerrno" . ($gzerrno+0) . "\n"
        if $gzerrno != Z_STREAM_END ;

    $gz->gzclose() ;
}

And this next one is obsessed with "gzreadline" β€” it's basically a very baby grep:

use strict ;
use warnings ;

use Compress::Zlib ;

die "Usage: gzgrep pattern [file...]\n"
    unless @ARGV >= 1;

my $pattern = shift ;

# use stdin if no files supplied
@ARGV = '-' unless @ARGV ;

foreach my $file (@ARGV) {
    my $gz = gzopen($file, "rb")
         or die "Cannot open $file: $gzerrno\n" ;

    while ($gz->gzreadline($_) > 0) {
        print if /$pattern/ ;
    }

    die "Error reading from $file: $gzerrno\n"
        if $gzerrno != Z_STREAM_END ;

    $gz->gzclose() ;
}

Then there's this one, gzstream, which does the exact opposite of the gzcat script above ✨ It reads from standard input and writes a gzip data stream out to standard output. Main character energy:

use strict ;
use warnings ;

use Compress::Zlib ;

binmode STDOUT;  # gzopen only sets it on the fd

my $gz = gzopen(\*STDOUT, "wb")
      or die "Cannot open stdout: $gzerrno\n" ;

while (<>) {
    $gz->gzwrite($_)
      or die "error writing: $gzerrno\n" ;
}

$gz->gzclose ;

Compress::Zlib::memGzip πŸ¦‹

This function builds an in-memory gzip file for you with the smallest possible gzip header β€” literally exactly 10 bytes, no cap 🎯

$dest = Compress::Zlib::memGzip($buffer)
    or die "Cannot compress: $gzerrno\n";

If it works, you get the in-memory gzip file back πŸ’– If it doesn't, you get "undef" and $gzerrno will be holding the zlib error code.

The $buffer parameter can be a scalar or a scalar reference β€” your choice, bestie.

Heads up: check out IO::Compress::Gzip if you want an alternative way to do in-memory gzip compression.

Compress::Zlib::memGunzip 🧚

This one's the reverse β€” it uncompresses an in-memory gzip file.

$dest = Compress::Zlib::memGunzip($buffer)
    or die "Cannot uncompress: $gzerrno\n";

Success? You get the uncompressed gzip file, slay ✨ Failure? "undef", and $gzerrno is holding the zlib error code.

The $buffer parameter can be a scalar or a scalar reference. Important though 🚨 the contents of the $buffer parameter get destroyed after you call this function. Gone. Poof.

Also: if $buffer is made of multiple concatenated gzip data streams, only the first one gets uncompressed. If you actually need to deal with concatenated data streams, use "gunzip" with the "MultiStream" option over in the "IO::Uncompress::Gunzip" module, okay? πŸ’…

Also also: IO::Uncompress::Gunzip is right there if you want an alternative way to do in-memory gzip uncompression.

🌈 COMPRESS/UNCOMPRESS 🌈

Two functions, one job each β€” in-memory compression and uncompression of RFC 1950 data streams. They're called "compress" and "uncompress". Cute, right? πŸŽ€

  • $dest = compress($source [, $level] ) ; β€” compresses $source. If it slays, you get the compressed data back. If not, you get undef. 😭 The source buffer, $source, can be either a scalar or a scalar reference. The $level parameter sets the compression level. Valid values are 0 through 9, "Z_NO_COMPRESSION", "Z_BEST_SPEED", "Z_BEST_COMPRESSION", and "Z_DEFAULT_COMPRESSION". If you don't specify $level, "Z_DEFAULT_COMPRESSION" gets used. Periodt.
  • $dest = uncompress($source) ; β€” uncompresses $source. Success means you get the uncompressed data. Otherwise, undef, sadly 🫢 The source buffer can be either a scalar or a scalar reference.
🚨 Please note: the two functions defined above are not compatible with the Unix commands of the same name. Like, do not assume they're the same thing. They are not. Thank you for coming to my TED talk πŸ’€

And if you want an alternative interface for reading/writing RFC 1950 files/buffers, go look at IO::Deflate and IO::Inflate β€” they're included with this distribution πŸ’œ

πŸ’– Deflate Interface πŸ’–

This section is all about an interface that lets you do in-memory compression with the deflate interface provided by zlib. Here’s the interface definition, bestie:

($d, $status) = deflateInit( [OPT] )

Sets up a deflation stream. Iconic.

It combines the features of the zlib functions deflateInit, deflateInit2 and deflateSetDictionary.

If successful, it will return the initialised deflation stream, $d, and $status of Z_OK in a list context. In scalar context it returns the deflation stream, $d, only.

If not successful, the returned deflation stream ($d) will be undef and $status will hold the exact zlib error code.

The function optionally takes a number of named options specified as -Name=>value pairs. This allows individual options to be tailored without having to specify them all in the parameter list.

For backward compatibility, it is also possible to pass the parameters as a reference to a hash containing the name=>value pairs.

The function takes one optional parameter, a reference to a hash. The contents of the hash allow the deflation interface to be tailored.

Here is a list of the valid options:

  • -Level β€” Defines the compression level. Valid values are 0 through 9, Z_NO_COMPRESSION, Z_BEST_SPEED, Z_BEST_COMPRESSION, and Z_DEFAULT_COMPRESSION.

The default is Z_DEFAULT_COMPRESSION.

  • -Method β€” Defines the compression method. The only valid value at present (and the default) is Z_DEFLATED.
  • -WindowBits β€” To create an RFC 1950 data stream, set WindowBits to a positive number.

To create an RFC 1951 data stream, set WindowBits to -MAX_WBITS.

For a full definition of the meaning and valid values for WindowBits refer to the zlib documentation for deflateInit2.

Defaults to MAX_WBITS.

  • -MemLevel β€” For a definition of the meaning and valid values for MemLevel refer to the zlib documentation for deflateInit2.

Defaults to MAX_MEM_LEVEL.

  • -Strategy β€” Defines the strategy used to tune the compression. The valid values are Z_DEFAULT_STRATEGY, Z_FILTERED and Z_HUFFMAN_ONLY.

The default is Z_DEFAULT_STRATEGY.

  • -Dictionary β€” When a dictionary is specified Compress::Zlib will automatically call deflateSetDictionary directly after calling deflateInit. The Adler32 value for the dictionary can be obtained by calling the method $d->dict_adler().

The default is no dictionary.

  • -Bufsize β€” Sets the initial size for the deflation buffer. If the buffer has to be reallocated to increase the size, it will grow in increments of Bufsize.

The default is 4096.

Here is an example of using the deflateInit optional parameter list to override the default buffer size and compression level. All other options will take their default values.

           deflateInit( -Bufsize => 300,
                        -Level => Z_BEST_SPEED  ) ;

($out, $status) = $d->deflate($buffer)

Deflates the contents of $buffer. The buffer can either be a scalar or a scalar reference. When finished, $buffer will be completely processed (assuming there were no errors). If the deflation was successful it returns the deflated output, $out, and a status value, $status, of Z_OK.

On error, $out will be undef and $status will contain the zlib error code.

In a scalar context deflate will return $out only.

As with the deflate function in zlib, it is not necessarily the case that any output will be produced by this method. So don’t rely on the fact that $out is empty for an error test.

($out, $status) = $d->flush() / ($out, $status) = $d->flush($flush_type)

Typically used to finish the deflation. Any pending output will be returned via $out. $status will have a value Z_OK if successful.

In a scalar context flush will return $out only.

⚠️ Note that flushing can seriously degrade the compression ratio, so it should only be used to terminate a decompression (using Z_FINISH) or when you want to create a full flush point (using Z_FULL_FLUSH).

By default the flush_type used is Z_FINISH. Other valid values for flush_type are Z_NO_FLUSH, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH and Z_FULL_FLUSH. It is strongly recommended that you only set the flush_type parameter if you fully understand the implications of what it does. See the zlib documentation for details.

$status = $d->deflateParams([OPT])

Change settings for the deflate stream $d.

The list of the valid options is shown below. Options not specified will remain unchanged.

  • -Level β€” Defines the compression level. Valid values are 0 through 9, Z_NO_COMPRESSION, Z_BEST_SPEED, Z_BEST_COMPRESSION, and Z_DEFAULT_COMPRESSION.
  • -Strategy β€” Defines the strategy used to tune the compression. The valid values are Z_DEFAULT_STRATEGY, Z_FILTERED and Z_HUFFMAN_ONLY.

$d->dict_adler()

Returns the adler32 value for the dictionary.

$d->msg()

Returns the last error message generated by zlib.

$d->total_in()

Returns the total number of bytes uncompressed bytes input to deflate.

$d->total_out()

Returns the total number of compressed bytes output from deflate.

🌟 Example 🌟

Here is a trivial example of using deflate. It simply reads standard input, deflates it and writes it to standard output.

           use strict ;
           use warnings ;

           use Compress::Zlib ;

           binmode STDIN;
           binmode STDOUT;
           my $x = deflateInit()
              or die "Cannot create a deflation stream\n" ;

           my ($output, $status) ;
           while (<>)
           {
               ($output, $status) = $x->deflate($_) ;

               $status == Z_OK
                   or die "deflation failed\n" ;

               print $output ;
           }

           ($output, $status) = $x->flush() ;

           $status == Z_OK
               or die "deflation failed\n" ;

           print $output ;

πŸ¦‹ Inflate Interface πŸ¦‹

This section defines the interface available that allows in-memory uncompression using the deflate interface provided by zlib. Yes, that’s what it says β€” we’re just rolling with it, bestie 😭.

Here is a definition of the interface:

($i, $status) = inflateInit()

Initialises an inflation stream.

In a list context it returns the inflation stream, $i, and the zlib status code in $status. In a scalar context it returns the inflation stream only.

If successful, $i will hold the inflation stream and $status will be Z_OK.

If not successful, $i will be undef and $status will hold the zlib error code.

The function optionally takes a number of named options specified as -Name=>value pairs. This allows individual options to be tailored without having to specify them all in the parameter list.

For backward compatibility, it is also possible to pass the parameters as a reference to a hash containing the name=>value pairs.

The function takes one optional parameter, a reference to a hash. The contents of the hash allow the deflation interface to be tailored.

Here is a list of the valid options:

  • -WindowBits β€” To uncompress an RFC 1950 data stream, set WindowBits to a positive number.

To uncompress an RFC 1951 data stream, set WindowBits to -MAX_WBITS.

For a full definition of the meaning and valid values for WindowBits refer to the zlib documentation for inflateInit2.

Defaults to MAX_WBITS.

  • -Bufsize β€” Sets the initial size for the inflation buffer. If the buffer has to be reallocated to increase the size, it will grow in increments of Bufsize.

Default is 4096.

  • -Dictionary β€” The default is no dictionary.

Here is an example of using the inflateInit optional parameter to override the default buffer size.

           inflateInit( -Bufsize => 300 ) ;

($out, $status) = $i->inflate($buffer)

Inflates the complete contents of $buffer. The buffer can either be a scalar or a scalar reference.

Returns Z_OK if successful and Z_STREAM_END if the end of the compressed data has been successfully reached. If not successful, $out will be undef and $status will hold the zlib error code.

The $buffer parameter is modified by inflate. On completion it will contain what remains of the input buffer after inflation. This means that $buffer will be an empty string when the return status is Z_OK. When the return status is Z_STREAM_END the $buffer parameter will contain what (if anything) was stored in the input buffer after the deflated data stream.

This feature is useful when processing a file format that encapsulates a compressed data stream (e.g. gzip, zip).

$status = $i->inflateSync($buffer)

Scans $buffer until it reaches either a full flush point or the end of the buffer.

If a full flush point is found, Z_OK is returned and $buffer will have all data up to the flush point removed. This can then be passed to the deflate method.

Any other return code means that a flush point was not found. If more data is available, inflateSync can be called repeatedly with more compressed data until the flush point is found.

$i->dict_adler()

Returns the adler32 value for the dictionary.

$i->msg()

Returns the last error message generated by zlib.

$i->total_in()

Returns the total number of bytes compressed bytes input to inflate.

$i->total_out()

Returns the total number of uncompressed bytes output from inflate.

🌟 Example 🌟

Here is an example of using inflate.

           use strict ;
           use warnings ;

           use Compress::Zlib ;

           my $x = inflateInit()
              or die "Cannot create a inflation stream\n" ;

           my $input = '' ;
           binmode STDIN;
           binmode STDOUT;

           my ($output, $status) ;
           while (read(STDIN, $input, 4096))
           {
               ($output, $status) = $x->inflate(\$input) ;

               print $output
                   if $status == Z_OK or $status == Z_STREAM_END ;

               last if $status != Z_OK ;
           }

           die "inflation failed\n"
               unless $status == Z_STREAM_END ;

✨ CHECKSUM FUNCTIONS ✨

okay bestie so zlib gives you two functions for checksums πŸ’… and here's the tea: for the Perl interface the order of the two params in both functions got flipped around. why? so you can do running checksums and one-off calculations, which is honestly iconic of it πŸŽ€

$crc = adler32($buffer [,$crc]) ;
$crc = crc32($buffer [,$crc]) ;

the $buffer params can be either a scalar or a scalar reference β€” either one works, no cap 🫢

and if the $crc param is "undef", the crc value gets reset. periodt. πŸ’€

if you built this module with zlib 1.2.3 or better, you get two more CRC-related functions, lucky you 🌸

$crc = crc32_combine($crc1, $crc2, $len2);
$adler = adler32_combine($adler1, $adler2, $len2);

these let checksums be merged β€” like, two checksums become one ✨ head to the zlib documentation for the deets, iykyk.


🌈 Misc 🌈

πŸ’– my $version = Compress::Zlib::zlib_version();

returns the version of the zlib library. that's it, that's the whole function, and honestly? she's serving exactly what she needs to serve πŸ‘‘


⭐ CONSTANTS ⭐

all the zlib constants are automatically imported when you make use of Compress::Zlib. no extra imports, no fiddling, they just show up like a bestie who knows what you need before you ask πŸ’œ


πŸ¦‹ SUPPORT πŸ¦‹

general feedback / questions / bug reports go to <https://github.com/pmqs/IO-Compress/issues> (that's the preferred one, bestie) or <https://rt.cpan.org/Public/Dist/Display.html?Name=IO-Compress> πŸŽ€


πŸ‘‘ SEE ALSO πŸ‘‘

the whole extended family, and we love them all:

  • IO::Compress::Gzip, IO::Uncompress::Gunzip, IO::Compress::Deflate, IO::Uncompress::Inflate, IO::Compress::RawDeflate, IO::Uncompress::RawInflate, IO::Compress::Bzip2, IO::Uncompress::Bunzip2, IO::Compress::Lzma, IO::Uncompress::UnLzma, IO::Compress::Xz, IO::Uncompress::UnXz, IO::Compress::Lzip, IO::Uncompress::UnLzip, IO::Compress::Lzop, IO::Uncompress::UnLzop, IO::Compress::Lzf, IO::Uncompress::UnLzf, IO::Compress::Zstd, IO::Uncompress::UnZstd, IO::Uncompress::AnyInflate, IO::Uncompress::AnyUncompress
  • IO::Compress::FAQ
  • File::GlobMapper, Archive::Zip, Archive::Tar, IO::Zlib

for RFC 1950, 1951 and 1952 go check out <https://datatracker.ietf.org/doc/html/rfc1950>, <https://datatracker.ietf.org/doc/html/rfc1951> and <https://datatracker.ietf.org/doc/html/rfc1952> πŸ“š

the zlib compression library was written by Jean-loup Gailly "gzip@prep.ai.mit.edu" and Mark Adler "madler@alumni.caltech.edu" β€” absolute legends, we stan πŸ™Œ


πŸŽ€ AUTHOR πŸŽ€

this module was written by Paul Marquess, "pmqs@cpan.org". main character energy fr fr πŸ’–


🌸 MODIFICATION HISTORY 🌸

see the Changes file. (yes, that's the whole thing, go look πŸ‘€)


Copyright (c) 1995-2026 Paul Marquess. All rights reserved.

this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay 🫢


a little sign-off from your girl: this page is Compress::Zlib(3), shipping with perl v5.42.0 and dated 2026-05-17 β€” go forth and compress responsibly, bestie πŸ’œβœ¨πŸŽ€
πŸ“¦ where this page comes from