NAME
Gzip::Zopfli - Zopfli deflate/gzip compression library
SYNOPSIS
use Gzip::Zopfli 'zopfli_compress';
my $in = 'something' x 1000;
my $out = zopfli_compress ($in);
print length ($out), ' ', length ($in), "\n";
produces output
62 9000
(This example is included as synopsis.pl in the distribution.)
VERSION
This documents version 0.02 of Gzip-Zopfli corresponding to git commit 676163dc6d271a6f3682cf586ad342bbc1a42fd4 released on Thu Jul 27 13:00:41 2023 +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.)
DESCRIPTION
This module offers access to the Zopfli compression library from Perl. Please note that the Zopfli does not offer decompression.
FUNCTIONS
zopfli_compress
my $out = zopfli_compress ($in, %options);
Compress $in
into $out
. The possible options are as follows:
- blocksplitting
-
my $out = zopfli_compress ($in, blocksplitting => 0);
Boolean. Apply blocksplitting or not? Default value is true.
- blocksplittingmax
-
my $out = zopfli_compress ($in, blocksplittingmax => 0);
Maximum number of blocks to split into. Default is 15. Set to 0 for unlimited.
- numiterations
-
my $out = zopfli_compress ($in, numiterations => 1);
Number of iterations. Default value is 15.
- type
-
my $out = zopfli_compress ($in, type => 'zlib');
Type of compression. Either
gzip
(the default),zlib
, ordeflate
.
zopfli_compress_file
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".
DEPENDENCIES
- File::Slurper
-
File::Slurper is used by "zopfli_compress_file" to read and write the files.
SEE ALSO
About Zopfli
See https://github.com/google/zopfli
CPAN
- Other implementations of Zopfli
- Other gzip/deflate/zlib compression libraries
-
- Compress::Raw::Zlib
-
Interface to the Zlib compression library.
- Gzip::Faster
-
Alternative interface to zlib.
- Gzip::Libdeflate
-
Gzip compression and decompression with the new libdeflate library.
- Other
AUTHOR
Ben Bullock, <bkb@cpan.org>
COPYRIGHT & LICENCE
This package and associated files are copyright (C) 2021-2023 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)