Gzip::Zopfli - Zopfli deflate/gzip compression library
use Gzip::Zopfli 'ZopfliCompress'; my $in = 'something' x 1000; my $out = ZopfliCompress ($in); print length ($out), ' ', length ($in), "\n";
produces output
62 9000
(This example is included as synopsis.pl in the distribution.)
This documents version 0.01 of Gzip-Zopfli corresponding to git commit ce701626022c4d9693449a17320e490adb09ffdb released on Mon Mar 1 10:35:58 2021 +0900.
This distribution also contains the source code of the Zopfli library version 1.0.3. See "COPYRIGHT & LICENCE" for the conditions under which this source code may be used (Apache Licence, copyright by Google Inc.)
This module offers access to the Zopfli compression library from Perl. Please note that the Zopfli does not offer decompression.
my $out = zopfli_compress ($in, %options);
Compress $in into $out. The possible options are as follows:
$in
$out
my $out = zopfli_compress ($in, blocksplitting => 0);
Boolean. Apply blocksplitting or not? Default value is true.
my $out = zopfli_compress ($in, blocksplittingmax => 0);
Maximum number of blocks to split into. Default is 15. Set to 0 for unlimited.
my $out = zopfli_compress ($in, numiterations => 1);
Number of iterations. Default value is 15.
my $out = zopfli_compress ($in, type => 'zlib');
Type of compression. Either gzip (the default), zlib, or deflate.
gzip
zlib
deflate
my $out = zopfli_compress_file (in => "file");
Compress from one file to another file:
zopfli_compress_file (in => $file, out => "$file.gz");
Compress from data to a file:
zopfli_compress_file (from => $data, out => 'compressed-file.gz');
It also accepts all the same options as "zopfli_compress".
File::Slurper is used by "zopfli_compress_file" to read and write the files.
See https://github.com/google/zopfli
Interface to the Zlib compression library.
Gzip compression and decompression with the new libdeflate library.
Alternative interface to zlib.
https://github.com/benkasminbullock/gzip-compare
Ben Bullock, <bkb@cpan.org>
This package and associated files are copyright (C) 2021 Ben Bullock.
You can use, copy, modify and redistribute this package and associated files under the Perl Artistic Licence or the GNU General Public Licence.
The underlying Zopfli library is included in this distribution. Zopfli is copyright and licensed as follows:
Copyright 2011 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Author: lode.vandevenne@gmail.com (Lode Vandevenne)
Author: jyrki.alakuijala@gmail.com (Jyrki Alakuijala)
To install Gzip::Zopfli, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gzip::Zopfli
CPAN shell
perl -MCPAN -e shell install Gzip::Zopfli
For more information on module installation, please visit the detailed CPAN module installation guide.