NAME
Gzip::Libdeflate - Perl interface to libdeflate
SYNOPSIS
use Gzip::Libdeflate;
VERSION
This documents version 0.00_03 of Gzip-Libdeflate corresponding to git commit 489fa5d4584b10d42beb4ab808df9bcc8145ca3c released on Sat Feb 13 14:07:32 2021 +0900. This distribution also includes libdeflate version 1.7.
DESCRIPTION
Interface to libdeflate. libdeflate offers the same forms of compression as zlib, as used in gzip, libpng and similar utilities. This distribution includes libdeflate within itself, so it is not necessary to have that on your system.
METHODS
compressor
my $co = Gzip::Libdeflate->compressor (%options);
- level
-
my $co = Gzip::Libdeflate->compressor (level => 9);
An optional number argument of compression level from 1 (fast and poor compression) to 12 (slow and good compression). If you do not specify it, the default is 6. These correspond to the compression levels of zlib, but with extra compression levels 10-12 also added. See "About libdeflate" for details.
- type
-
my $co = Gzip::Libdeflate->compressor (type => 'deflate');
Change the type of compression. The default is type
gzip
but you can also choosedeflate
andzlib
. These are all the same thing up to headers.
decompressor
my $de = Gzip::Libdeflate->decompressor (%options);
- type
-
Either
deflate
,zlib
, orgzip
(the default). See "compressor" for details.
compress
my $comp_thing = $gl->compress ($thing);
Compress input $thing
using whatever compression level and type you have specified for $gl
in "compressor".
decompress
my $thing = $gl->decompress ($dthing);
Decompress c<$comp_thing> into $thing
. If you have chosen the zlib
or deflate
options in "decompressor", you also need to specify the expected size of $thing
.
my $thing = $gl->decompress ($dthing, 1000);
In the gzip
format, the size is stored within the data itself so it doesn't need to be specified.
SEE ALSO
About libdeflate
Libdeflate is an updated version of zlib
. See the Libdeflate github repository for information.
CPAN modules
AUTHOR
Ben Bullock, <bkb@cpan.org>
COPYRIGHT & LICENCE
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.
Libdeflate's copyright and licence are as follows.
Copyright 2016 Eric Biggers
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.