]> iEval git - io-compress-brotli.git/blame - lib/IO/Uncompress/Brotli.pm
Use gmake if available to compile brotli library
[io-compress-brotli.git] / lib / IO / Uncompress / Brotli.pm
CommitLineData
f9995f31
MG
1package IO::Uncompress::Brotli;
2
3use 5.014000;
4use strict;
5use warnings;
6use parent qw/Exporter/;
7
8our @EXPORT = qw/unbro/;
9our @EXPORT_OK = @EXPORT;
10
b0ba4271 11our $VERSION = '0.002';
f9995f31
MG
12
13require XSLoader;
14XSLoader::load('IO::Compress::Brotli', $VERSION);
15
f9995f31
MG
161;
17__END__
18
19=encoding utf-8
20
21=head1 NAME
22
23IO::Uncompress::Brotli - Read Brotli buffers/streams
24
25=head1 SYNOPSIS
26
27 use IO::Uncompress::Brotli;
28
29 # uncompress a buffer
30 my $decoded = unbro $encoded;
31
32 # uncompress a stream
33 my $bro = IO::Uncompress::Brotli->create;
34 while(have_input()) {
35 my $block = get_input_block();
36 my $decoded_block = $bro->decompress($block);
37 handle_output_block($decoded_block);
38 }
39
40=head1 DESCRIPTION
41
42IO::Uncompress::Brotli is a module that decompresses Brotli buffers
43and streams. Despite its name, it is not a subclass of
44L<IO::Uncompress::Base> and does not implement its interface. This
45will be rectified in a future release.
46
47=head2 One-shot interface
48
49If you have the whole buffer in a Perl scalar use the B<unbro>
50function.
51
52=over
53
54=item B<unbro>(I<$input>)
55
56Takes a whole compressed buffer as input and returns the decompressed
57data. This function relies on the BrotliDecompressedSize function. In
58other words, it only works if the buffer has a single meta block or
59two meta-blocks where the first is uncompressed and the second is
60empty.
61
62Exported by default.
63
64=back
65
66=head2 Streaming interface
67
68If you want to process the data in blocks use the object oriented
69interface. The available methods are:
70
71=over
72
73=item IO::Uncompress::Brotli->B<create>
74
75Returns a IO::Uncompress::Brotli instance. Please note that a single
76instance cannot be used to decompress multiple streams.
77
78=item $bro->B<decompress>(I<$block>)
79
80Takes the a block of compressed data and returns a block of
81uncompressed data. Dies on error.
82
83=back
84
85=head1 SEE ALSO
86
87Brotli Compressed Data Format Internet-Draft:
88L<https://www.ietf.org/id/draft-alakuijala-brotli-08.txt>
89
90Brotli source code: L<https://github.com/google/brotli/>
91
92=head1 AUTHOR
93
94Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
95
4c5aa4f8
MG
96The encoder bindings, modernisation of the decoder bindings and a
97clean up of the overall project were contributed by:
98
99=over
100
101=item Quim Rovira, E<lt>quim@rovira.catE<gt>
102
103=item Ævar Arnfjörð Bjarmason, E<lt>avarab@gmail.comE<gt>
104
105=item Marcell Szathmári
106
107=item Mattia Barbon, E<lt>mattia@barbon.orgE<gt>
108
f9995f31
MG
109=head1 COPYRIGHT AND LICENSE
110
b0ba4271 111Copyright (C) 2015-2016 by Marius Gavrilescu
f9995f31
MG
112
113This library is free software; you can redistribute it and/or modify
114it under the same terms as Perl itself, either Perl version 5.20.2 or,
115at your option, any later version of Perl 5 you may have available.
116
117
118=cut
This page took 0.032166 seconds and 4 git commands to generate.