IO::Co...::Gzip(3perl)

🌸 IO::Compress::Gzip πŸ’–

okay bestie, welcome to the IO::Compress::Gzip(3perl) page from the Perl Programmers Reference Guide ✨ it's a lot of words but it's SO worth it, this module is the moment, it's the blueprint, it's lowkey the whole gzip situation. hydrate, sit down, we're doing this 🫢


✨ NAME ✨

IO::Compress::Gzip β€” Write RFC 1952 files/buffers. that's the whole job description, iconic πŸ’…


✨ SYNOPSIS ✨

use IO::Compress::Gzip qw(gzip $GzipError) ;

my $status = gzip $input => $output [,OPTS]
    or die "gzip failed: $GzipError\n";

my $z = IO::Compress::Gzip->new( $output [,OPTS] )
    or die "gzip failed: $GzipError\n";

$z->print($string);
$z->printf($format, $string);
$z->write($string);
$z->syswrite($string [, $length, $offset]);
$z->flush();
$z->tell();
$z->eof();
$z->seek($position, $whence);
$z->binmode();
$z->fileno();
$z->opened();
$z->autoflush();
$z->input_line_number();
$z->newStream( [OPTS] );

$z->deflateParams();

$z->close() ;

$GzipError ;

# IO::File mode

print $z $string;
printf $z $format, $string;
tell $z
eof $z
seek $z, $position, $whence
binmode $z
fileno $z
close $z ;

✨ DESCRIPTION ✨

so like, this module hands you a Perl interface that lets you write compressed data to files or buffers exactly the way RFC 1952 says to. periodt.

and every single gzip header that RFC 1952 defines? you can create all of them with this module. all of them. no notes πŸ”₯

now, if you're trying to read RFC 1952 files/buffers instead of write them, you want the companion module IO::Uncompress::Gunzip β€” that's its bestie, not its twin πŸ™ˆ

πŸ’« Functional Interface πŸ’«

there's a top-level function called gzip that does the "one-shot" compression thing between buffers and/or files. it's giving effortless. but if you want finer control over the compression process, go look at the "OO Interface" section instead πŸ‘‘

use IO::Compress::Gzip qw(gzip $GzipError) ;

gzip $input_filename_or_reference => $output_filename_or_reference [,OPTS]
    or die "gzip failed: $GzipError\n";

fr fr, this functional interface needs Perl5.005 or better. no old-school Perls allowed, sorry not sorry πŸ’…

gzip $input_filename_or_reference => $output_filename_or_reference [, OPTS]

gzip wants at least two parameters β€” $input_filename_or_reference and $output_filename_or_reference β€” plus zero or more optional parameters (those live in "Optional Parameters").

πŸ’œ The $input_filename_or_reference parameter πŸ’œ

this parameter is the one that defines where the uncompressed data comes from. it can show up in any of these forms:

  • A filename β€” if $input_filename_or_reference is a simple scalar, it's assumed to be a filename. that file gets opened for reading and the input data gets read out of it. simple, clean, slay.
  • A filehandle β€” if $input_filename_or_reference is a filehandle, the input data is read from it. the string '-' can be used as an alias for standard input 🌸
  • A scalar reference β€” if $input_filename_or_reference is a scalar reference, the input data is read from $$input_filename_or_reference.
  • An array reference β€” if $input_filename_or_reference is an array reference, every element in that array has to be a filename.

the input data gets read from each file, in turn.

and the complete array gets walked first to make sure it only contains valid filenames, all of that before any data is compressed. it checks before it wrecks πŸ’…

  • An Input FileGlob string β€” if $input_filename_or_reference is a string delimited by the characters < and >, gzip is gonna assume it's an input fileglob string. the input is then the list of files that match the fileglob.

see File::GlobMapper for more details πŸ“–

if $input_filename_or_reference is any other type? undef gets returned. that's it, that's the whole answer 😭

and one more thing bestie: if $input_filename_or_reference is a simple filename, the default values for the "Name" and "Time" options get sourced from that file.

if you are NOT about those defaults, you can override them by explicitly setting the "Name" and "Time" options β€” or by setting the "Minimal" parameter. your call, main character πŸ‘‘

πŸ¦‹ The $output_filename_or_reference parameter πŸ¦‹

$output_filename_or_reference is the one that controls where the compressed data goes. it can take one of these forms:

  • A filename β€” if $output_filename_or_reference is a simple scalar, it's assumed to be a filename. this file gets opened for writing and the compressed data gets written into it.
  • A filehandle β€” if $output_filename_or_reference is a filehandle, the compressed data gets written to it. the string '-' can be used as an alias for standard output ✨
  • A scalar reference β€” if $output_filename_or_reference is a scalar reference, the compressed data gets stored in $$output_filename_or_reference.
  • An Array Reference β€” if $output_filename_or_reference is an array reference, the compressed data gets pushed onto the array.
  • An Output FileGlob β€” if $output_filename_or_reference is a string delimited by the characters < and >, gzip is gonna assume it's an output fileglob string. the output is the list of files that match the fileglob.
heads up bestie: when $output_filename_or_reference is a fileglob string, then $input_filename_or_reference must also be a fileglob string. anything else is an error, no exceptions πŸ’€

see File::GlobMapper for more details πŸ“–

if $output_filename_or_reference is any other type, undef gets returned. again. it's a whole thing.

πŸ“ Notes πŸ“

when $input_filename_or_reference maps to multiple files/buffers and $output_filename_or_reference is a single file/buffer, those input files/buffers get stored in $output_filename_or_reference as a concatenated series of compressed data streams. stack 'em, don't crack 'em 🫢

πŸŽ€ Optional Parameters πŸŽ€

the optional parameters for the one-shot function gzip are (for the most part) identical to the ones used with the OO interface over in the "Constructor Options" section. the exceptions are listed below πŸ‘‡

  • "AutoClose => 0|1" β€” this option applies to any input or output data streams handed to gzip that are filehandles.

if "AutoClose" is specified and the value is true, it results in all input and/or output filehandles being closed once gzip has completed.

this parameter defaults to 0.

  • "BinModeIn => 0|1" β€” this option is now a no-op. all files will be read in binmode. it said what it said πŸ™ˆ
  • "Append => 0|1" β€” the behaviour of this option depends on the type of output data stream, so let's break it all the way down:
    • A Buffer β€” if "Append" is enabled, all compressed data gets appended to the end of the output buffer. otherwise the output buffer gets cleared before any compressed data is written to it.
    • A Filename β€” if "Append" is enabled, the file is opened in append mode. otherwise the contents of the file, if there are any, get truncated before any compressed data is written to it.
    • A Filehandle β€” if "Append" is enabled, the filehandle gets positioned to the end of the file via a call to "seek" before any compressed data is written to it. otherwise the file pointer doesn't get moved at all.

when "Append" is specified and set to true, it appends all compressed data to the output data stream.

so: when the output is a filehandle, it carries out a seek to the eof before writing any compressed data. when the output is a filename, it gets opened for appending. when the output is a buffer, all compressed data gets appended to the existing buffer. all roads lead to appending ✨

conversely, when "Append" is not specified β€” or it's present and set to false β€” it operates like this instead:

when the output is a filename, it truncates the contents of the file before writing any compressed data. when the output is a filehandle, its position is not changed. when the output is a buffer, it gets wiped before any compressed data is output.

defaults to 0.

🌈 Oneshot Examples 🌈

here are a few examples showing off what this module can actually do. brace yourself, it's cute.

Streaming

this very simple command line example demonstrates the streaming capabilities of the module. the code reads data from STDIN, compresses it, and writes the compressed data to STDOUT.

$ echo hello world | perl -MIO::Compress::Gzip=gzip -e 'gzip \*STDIN => \*STDOUT' >output.gz

the special filename "-" can be used as a standin for both "\*STDIN" and "\*STDOUT", so the above can be rewritten as

$ echo hello world | perl -MIO::Compress::Gzip=gzip -e 'gzip "-" => "-"' >output.gz

Compressing a file from the filesystem

to read the contents of the file "file1.txt" and write the compressed data to the file "file1.txt.gz":

use strict ;
use warnings ;
use IO::Compress::Gzip qw(gzip $GzipError) ;

my $input = "file1.txt";
gzip $input => "$input.gz"
    or die "gzip failed: $GzipError\n";

Reading from a Filehandle and writing to an in-memory buffer

to read from an existing Perl filehandle, $input, and write the compressed data to a buffer, $buffer:

use strict ;
use warnings ;
use IO::Compress::Gzip qw(gzip $GzipError) ;
use IO::File ;

my $input = IO::File->new( "<file1.txt" )
    or die "Cannot open 'file1.txt': $!\n" ;
my $buffer ;
gzip $input => \$buffer
    or die "gzip failed: $GzipError\n";

Compressing multiple files

to compress all files in the directory "/my/home" that match "*.txt" and store the compressed data in the same directory:

use strict ;
use warnings ;
use IO::Compress::Gzip qw(gzip $GzipError) ;

gzip '</my/home/*.txt>' => '<*.gz>'
    or die "gzip failed: $GzipError\n";

and if you want to compress each file one at a time, this will do the trick:

use strict ;
use warnings ;
use IO::Compress::Gzip qw(gzip $GzipError) ;

for my $input ( glob "/my/home/*.txt" )
{
    my $output = "$input.gz" ;
    gzip $input => $output
        or die "Error compressing '$input': $GzipError\n";
}

πŸ‘‘ OO Interface πŸ‘‘

🌟 Constructor 🌟

the format of the constructor for IO::Compress::Gzip is shown below:

my $z = IO::Compress::Gzip->new( $output [,OPTS] )
    or die "IO::Compress::Gzip failed: $GzipError\n";

the constructor takes one mandatory parameter, $output (defined below), and zero or more "OPTS", which are defined over in "Constructor Options".

it returns an "IO::Compress::Gzip" object on success and undef on failure. and the variable $GzipError will contain an error message on failure, so you always know what went down πŸ’€βœ¨


okay so that's the setup, the vibe, the whole blueprint β€” the options themselves are a whole other saga and we are NOT done yet, stay with me 🌸

If you're on Perl 5.005 or newer, the object $z that IO::Compress::Gzip hands you back can be used exactly like an IO::File filehandle. Like, literally every normal output file operation works on $z πŸ’–. So if you wanna write to a compressed file or buffer, both of these hit:

$z->print("hello world\n");
print $z "hello world\n";

Here's a lil baby example of the OO interface creating an output file "myfile.gz" and tossing some data at it:

my $filename = "myfile.gz";
my $z = IO::Compress::Gzip->new($filename)
    or die "IO::Compress::Gzip failed: $GzipError\n";

$z->print("abcde");
$z->close();

Wanna see more? Go peep the "Examples" section πŸ‘€

So the mandatory parameter $output β€” that's the thing that decides where your compressed data actually lands. It can be one of these flavors:

  • A filename β€” if $output is just a plain scalar, it's treated as a filename. The file gets opened for writing and all the compressed data gets written into it. Simple as that.
  • A filehandle β€” if $output is a filehandle, the compressed data goes there. Oh and you can totally use the string '-' as an alias for standard output 🫢
  • A scalar reference β€” if $output is a scalar reference, the compressed data gets stored in $$output. Iconic.

And if $output is literally any other type? Then IO::Compress::Gzip::new just returns undef. Yeah. Sorry bestie πŸ’€

✨ Constructor Options ✨

OPTS is any combo of zero or more of these bad boys:

  • AutoClose => 0|1 β€” only valid when $output is a filehandle. If you set it and the value is true, $output gets closed once either the close method is called or the IO::Compress::Gzip object gets destroyed. Defaults to 0.
  • Append => 0|1 β€” opens $output in append mode. What that actually means depends on what $output is:
    • A Buffer β€” if $output is a buffer and Append is on, all compressed data gets appended to the end of $output. Otherwise $output gets cleared before anything is written to it.
    • A Filename β€” if $output is a filename and Append is on, the file opens in append mode. Otherwise the file's contents (if it even had any) get truncated before any compressed data is written.
    • A Filehandle β€” if $output is a filehandle, the file pointer gets moved to the end of the file via a seek call before any compressed data is written. Otherwise the file pointer stays put.

Defaults to 0.

  • Merge => 0|1 β€” this one's for compressing input data and appending it onto an existing compressed data stream in $output. End result? One single compressed data stream living in $output. Cute.
Heads up: it's a fatal error to try this option when $output isn't an RFC 1952 data stream. No cap.

And there's more drama β€” the Merge option comes with limitations:

  1. This module has to have been built with zlib 1.2.1 or better for it to work. Use Merge with an older zlib and you get a fatal error thrown at you.
  2. If $output is a file or a filehandle, it must be seekable.

Defaults to 0.

  • -Level β€” sets the compression level zlib uses. Value should be a number between 0 and 9 (0 = no compression, 9 = maximum compression), or one of the symbolic constants below:
Z_NO_COMPRESSION
Z_BEST_SPEED
Z_BEST_COMPRESSION
Z_DEFAULT_COMPRESSION

Default is Z_DEFAULT_COMPRESSION.

Oh, and quick note β€” these constants are not imported by IO::Compress::Gzip by default. You gotta ask nicely:

use IO::Compress::Gzip qw(:strategy);
use IO::Compress::Gzip qw(:constants);
use IO::Compress::Gzip qw(:all);
  • -Strategy β€” sets the strategy used to tune the compression. Pick one of these symbolic constants:
Z_FILTERED
Z_HUFFMAN_ONLY
Z_RLE
Z_FIXED
Z_DEFAULT_STRATEGY

Default is Z_DEFAULT_STRATEGY.

  • Minimal => 0|1 β€” turn this on and it forces the creation of the smallest possible compliant gzip header (which is exactly 10 bytes long, fr), as defined in RFC 1952.

Wanna know what values go in which header fields? Check out the section titled "Compliance" in RFC 1952.

Also, if this is set to 1, all the other parameters that control what's in the gzip header get ignored. Sorry to them.

Defaults to 0.

  • Comment => $comment β€” stashes the contents of $comment into the COMMENT field of the gzip header. By default, no comment field gets written to the gzip file at all.

If -Strict is enabled, the comment can only be ISO 8859-1 characters plus line feed.

If -Strict is disabled, the comment field can hold any character except NULL. And if any null characters show up? The field gets truncated at the first NULL. Boom.

  • Name => $string β€” stashes $string into the gzip NAME header field. If Name isn't specified, no gzip NAME field gets created.

If -Strict is enabled, $string can only be ISO 8859-1 characters.

If -Strict is disabled, $string can hold any character except NULL. Same deal as before: null characters mean the field gets truncated at the first NULL.

  • Time => $number β€” sets the MTIME field in the gzip header to $number.

If you don't specify this option, the field defaults to the time the IO::Compress::Gzip object was created.

  • TextFlag => 0|1 β€” controls the FLG.FTEXT bit in the gzip header. That bit is basically a lil signal saying "hey, the data in this gzip file/buffer is probably text."

Default is 0.

  • HeaderCRC => 0|1 β€” when it's true, this sets the FLG.FHCRC bit to 1 in the gzip header and sets the CRC16 header field to the CRC of the entire gzip header except the CRC16 field itself.
Real talk though: gzip files created with HeaderCRC set to 1 cannot be read by most β€” if not all β€” of the standard gunzip utilities, most notably gzip version 1.2.4. So if you want your gzip files to be as portable as possible, avoid this option. Please 😭

Defaults to 0.

  • OS_Code => $value β€” stores $value in the gzip OS header field. Any number between 0 and 255 is valid.

If you don't specify it, this defaults to the OS code of the Operating System this module was built on. Fun fact: the value 3 is the catch-all for all Unix variants and unknown Operating Systems. Slay.

  • ExtraField => $data β€” this lets you stash extra metadata in the ExtraField of the gzip header. An RFC 1952 compliant ExtraField is made of zero or more subfields, and each subfield is a two byte header followed by the subfield data.

You can hand over the list of subfields in any of these formats:

-ExtraField => [$id1, $data1,
                $id2, $data2,
                 ...
               ]
-ExtraField => [ [$id1 => $data1],
                 [$id2 => $data2],
                 ...
               ]
-ExtraField => { $id1 => $data1,
                 $id2 => $data2,
                 ...
               }

Where $id1, $id2 are two byte subfield ID's. The second byte of the ID can't be 0 β€” unless you've disabled the Strict option.

If you go with the hash syntax, just know you have zero control over the order the ExtraSubFields get stored in, plus you can't have SubFields with duplicate IDs. Trade-offs, bestie.

Alternatively you can hand over the list of subfields as a scalar, like this:

-ExtraField => $rawdata

If you use the raw format and Strict is enabled, IO::Compress::Gzip will check that $rawdata consists of zero or more conformant sub-fields. When Strict is disabled, $rawdata can be any arbitrary byte stream you want.

The maximum size of the Extra Field is 65535 bytes.

  • ExtraFlags => $value β€” sets the XFL byte in the gzip header to $value.

If this option isn't present, the value stored in the XFL field gets determined by whatever the Level option is set to:

  • If Level => Z_BEST_SPEED was specified, XFL is set to 2.
  • If Level => Z_BEST_COMPRESSION was specified, XFL is set to 4.
  • Otherwise, XFL is set to 0.
  • Strict => 0|1 β€” Strict optionally polices the values you supply with the other options, making sure they're compliant with RFC1952. It's enabled by default, btw.

When Strict is enabled, all this behaviour gets policed:

  • The value given with the Name option can only contain ISO 8859-1 characters.
  • The value given with the Comment option can only contain ISO 8859-1 characters plus line-feed.
  • The values given with the -Name and -Comment options can't contain multiple embedded nulls.
  • If an ExtraField option is specified and it's a simple scalar, it must conform to the sub-field structure defined in RFC 1952.
  • If an ExtraField option is specified, the second byte of the ID gets checked in every subfield to make sure it doesn't hold the reserved value 0x00.

When Strict is disabled, all this behaviour gets policed:

  • The value given with the -Name option can contain any character except NULL.
  • The value given with the -Comment option can contain any character except NULL.
  • The values given with the -Name and -Comment options can contain multiple embedded nulls. The string written to the gzip header will consist of the characters up to β€” but not including β€” the first embedded NULL.
  • If an ExtraField option is specified and it's a simple scalar, the structure won't be checked at all. The only error you'll get is if the length is too big.
  • The ID header in an ExtraField sub-field can consist of any two bytes. No cap, literally any two. 🎲

πŸ’– Examples πŸ’–

🌊 Streaming 🌊

This super simple command line example is showing off the streaming glow-up of the module. The code reads data from STDIN β€” or all the files you hand it on the commandline, bestie β€” compresses it, and writes the compressed data right out to STDOUT. Chef's kiss. πŸ‘©β€πŸ³πŸ’‹

use strict ;
use warnings ;
use IO::Compress::Gzip qw(gzip $GzipError) ;

my $z = IO::Compress::Gzip->new("-", Stream => 1)
    or die "IO::Compress::Gzip failed: $GzipError\n";

while (<>) {
    $z->print("abcde");
}
$z->close();

Not the use of "-" to mean "STDOUT". Alternatively you can use "\*STDOUT". Both are giving. ✨

πŸ“ Compressing a file from the filesystem πŸ“

So you wanna read the contents of the file file1.txt and write the compressed data to the file file1.txt.gz? Iconic. There are a few options here, and here's the vibe:

Start by creating the compression object and opening the input file 🫢

use strict ;
use warnings ;
use IO::Compress::Gzip qw(gzip $GzipError) ;

my $input = "file1.txt";
my $z = IO::Compress::Gzip->new("file1.txt.gz")
    or die "IO::Compress::Gzip failed: $GzipError\n";

# open the input file
open my $fh, "<", "file1.txt"
    or die "Cannot open file1.txt: $!\n";

# loop through the input file & write to the compressed file
while (<$fh>) {
    $z->print($_);
}

# not forgetting to close the compressed file
$z->close();

πŸ› οΈ Methods πŸ› οΈ

✨ print ✨

Usage is

$z->print($data)
print $z $data

Compresses and outputs the contents of the $data parameter. Same behaviour as the built-in print, fr fr.

Returns true if it worked. πŸŽ€

✨ printf ✨

Usage is

$z->printf($format, $data)
printf $z $format, $data

Compresses and outputs the contents of the $data parameter.

Returns true if it worked. πŸŽ€

✨ syswrite ✨

Usage is

$z->syswrite $data
$z->syswrite $data, $length
$z->syswrite $data, $length, $offset

Compresses and outputs the contents of the $data parameter.

Returns the number of uncompressed bytes written, or undef if it flops. 😭

✨ write ✨

Usage is

$z->write $data
$z->write $data, $length
$z->write $data, $length, $offset

Compresses and outputs the contents of the $data parameter.

Returns the number of uncompressed bytes written, or undef if it flops. 😭

✨ flush ✨

Usage is

$z->flush;
$z->flush($flush_type);

Flushes any pending compressed data out to the output file/buffer. Poosh it out. πŸ’¨

This method takes an optional parameter, $flush_type, that controls how the flushing gets 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. Now listen bestie β€” it is strongly recommended that you only set the flush_type parameter if you fully, completely understand the implications of what it does, because overuse of flush can seriously degrade the level of compression you achieve. Don't do it just for fun. 😭 See the zlib documentation for the details.

Returns true on success. 🌸

✨ tell ✨

Usage is

$z->tell()
tell $z

Returns the uncompressed file offset. πŸ“

✨ eof ✨

Usage is

$z->eof();
eof($z);

Returns true if the close method has been called.

✨ seek ✨

$z->seek($position, $whence);
seek($z, $position, $whence);

Provides a sub-set of the seek functionality, with the restriction that it is only legal to seek forward in the output file/buffer. Attempting to seek backward is a fatal error. Periodt. 🚫

Empty parts of the file/buffer will have NULL (0x00) bytes written to them.

The $whence parameter takes one of the usual values, namely SEEK_SET, SEEK_CUR or SEEK_END.

Returns 1 on success, 0 on failure.

✨ binmode ✨

Usage is

$z->binmode
binmode $z ;

This is a noop, provided purely for completeness. It's giving "I'm just here so I don't get fined". πŸ’…

✨ opened ✨

$z->opened()

Returns true if the object currently refers to an opened file/buffer.

✨ autoflush ✨

my $prev = $z->autoflush()
my $prev = $z->autoflush(EXPR)

If the $z object is associated with a file or a filehandle, this method returns the current autoflush setting for the underlying filehandle. If EXPR is present, and is non-zero, it will enable flushing after every write/print operation.

If $z is associated with a buffer, this method has no effect and always returns undef.

Heads up bestie: the special variable $| can not be used to set or retrieve the autoflush setting. Literally cannot. πŸ™ˆ

✨ input_line_number ✨

$z->input_line_number()
$z->input_line_number(EXPR)

This method always returns undef when compressing. Always. Every time. 🫠

✨ fileno ✨

$z->fileno()
fileno($z)

If the $z object is associated with a file or a filehandle, fileno will return the underlying file descriptor. Once the close method has been called, fileno will return undef.

If the $z object is associated with a buffer, this method will return undef.

✨ close ✨

$z->close() ;
close $z ;

Flushes any pending compressed data and then closes the output file/buffer. Bye bye πŸ‘‹

For most versions of Perl this method will be automatically invoked if the IO::Compress::Gzip object is destroyed (either explicitly, or by the variable with the reference to the object going out of scope). The exceptions are Perl versions 5.005 through 5.00504 and 5.8.0. In these cases, the close method will be called automatically, but not until global destruction of all live objects when the program is terminating. Yeah. Scary.

So therefore, if you want your scripts to be able to run on all versions of Perl, you should call close explicitly and not rely on automatic closing. Do the responsible thing, bestie. 🫢

Returns true on success, otherwise 0.

If the AutoClose option has been enabled when the IO::Compress::Gzip object was created, and the object is associated with a file, the underlying file will also be closed.

✨ newStream([OPTS]) ✨

Usage is

$z->newStream( [OPTS] )

Closes the current compressed data stream and starts a new one. Fresh start energy. 🌈

OPTS consists of any of the options that are available when creating the $z object.

See the "Constructor Options" section for more details.

✨ deflateParams ✨

Usage is

$z->deflateParams

TODO. That's it. That's the documentation. πŸ’€


πŸ“¦ Importing πŸ“¦

A number of symbolic constants are required by some methods in "IO::Compress::Gzip". None are imported by default.

  • :all β€” Imports gzip, $GzipError and all symbolic constants that can be used by "IO::Compress::Gzip". Same as doing this:
use IO::Compress::Gzip qw(gzip $GzipError :constants) ;
  • :constants β€” Import all symbolic constants. Same as doing this:
use IO::Compress::Gzip qw(:flush :level :strategy) ;
  • :flush β€” These symbolic constants are used by the flush method.
Z_NO_FLUSH
Z_PARTIAL_FLUSH
Z_SYNC_FLUSH
Z_FULL_FLUSH
Z_FINISH
Z_BLOCK
  • :level β€” These symbolic constants are used by the Level option in the constructor.
Z_NO_COMPRESSION
Z_BEST_SPEED
Z_BEST_COMPRESSION
Z_DEFAULT_COMPRESSION
  • :strategy β€” These symbolic constants are used by the Strategy option in the constructor.
Z_FILTERED
Z_HUFFMAN_ONLY
Z_RLE
Z_FIXED
Z_DEFAULT_STRATEGY

🌟 EXAMPLES 🌟

πŸ§™ Apache::GZip Revisited πŸ§™

See IO::Compress::FAQ

🌐 Working with Net::FTP 🌐

See IO::Compress::FAQ


🫢 SUPPORT 🫢

General feedback / questions / bug reports should be sent to <https://github.com/pmqs/IO-Copress/issues> (preferred, bestie) or <https://rt.cpan.org/Public/Dist/Display.html?Name=IO-Copress>.


πŸ‘€ SEE ALSO πŸ‘€

Compress::Zlib, 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 see <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. πŸ‘‘

The primary site for the zlib compression library is <http://www.zlib.org>.

The primary site for the zlib-ng compression library is <https://github.com/zlib-ng/zlib-ng>.

The primary site for gzip is <http://www.gzip.org>.


πŸ’œ AUTHOR πŸ’œ

This module was written by Paul Marquess, "pmqs@cpan.org". We stan. πŸŽ€


πŸ“œ MODIFICATION HISTORY πŸ“œ

See the Changes file.


Copyright (c) 2005-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.


and that's a wrap bestie!! πŸ¦‹βœ¨ this page is from perl v5.44.0, dated 2026-10-17, and it's the IO::Compress::Gzip(3perl) manpage β€” go forth and compress, you gorgeous main character πŸ‘‘πŸ’–

πŸ“¦ where this page comes from
  • arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms