Compress::Zopfli

Perl Bindings for Google Zopfli Compression Algorithm

Build Status CPAN version

SYNOPSIS

use Compress::Zopfli;
$gz = compress($input, ZOPFLI_FORMAT_GZIP, {
    iterations => 15,
    blocksplitting => 1,
    blocksplittingmax => 15,
});

DESCRIPTION

The Compress::Zopfli module provides a Perl interface to the zopfli compression library. The zopfli library is bundled with Compress::Zopfli , so you don't need the zopfli library installed on your system.

The zopfli library only contains one single compression function, which is directly available via Compress::Zopfli. It supports three different compression variations. See "CONSTANTS" for a complete list.

COMPRESS

The zopfli library can only compress, not decompress. Existing zlib or deflate libraries can decompress the data, i.e. IO::Compress.

$compressed = compress( $input, ZOPFLI_FORMAT, \%opts )

This is the only function provided by Compress::Zopfli. The input must be a string, as the underlying function does not seem to support any streaming interface. More convenient APIs may be implemented on top.

OPTIONS

Options map directly to the zopfli low-level function. Must be a hash reference (i.e. anonymous hash) and supports the following options:

ALIASES

You probably only want to use a certain compression type. Use one of the module aliases to avoid passing the ZOPFLI_FORMAT:

They export one compress function without the ZOPFLI_FORMAT option.

use Compress::Zopfli::Deflate;
compress $input, { iterations: 20 };

CONSTANTS

All the zopfli constants are automatically imported when you make use of Compress::Zopfli.

AUTHOR

MODIFICATION HISTORY

See the Changes file.