]>
iEval git - io-compress-brotli.git/blob - Brotli.pm
f4230ef2650670b63c7af8c99b94dcc5766aea6c
1 package IO
::Uncompress
::Brotli
;
6 use parent qw
/Exporter/;
8 our @EXPORT = qw
/unbro/;
9 our @EXPORT_OK = @EXPORT;
11 our $VERSION = '0.001001';
14 XSLoader
::load
('IO::Compress::Brotli', $VERSION);
23 IO::Uncompress::Brotli - Read Brotli buffers/streams
27 use IO::Uncompress::Brotli;
30 my $decoded = unbro $encoded;
33 my $bro = IO::Uncompress::Brotli->create;
35 my $block = get_input_block();
36 my $decoded_block = $bro->decompress($block);
37 handle_output_block($decoded_block);
42 IO::Uncompress::Brotli is a module that decompresses Brotli buffers
43 and streams. Despite its name, it is not a subclass of
44 L<IO::Uncompress::Base> and does not implement its interface. This
45 will be rectified in a future release.
47 =head2 One-shot interface
49 If you have the whole buffer in a Perl scalar use the B<unbro>
54 =item B<unbro>(I<$input>)
56 Takes a whole compressed buffer as input and returns the decompressed
57 data. This function relies on the BrotliDecompressedSize function. In
58 other words, it only works if the buffer has a single meta block or
59 two meta-blocks where the first is uncompressed and the second is
66 =head2 Streaming interface
68 If you want to process the data in blocks use the object oriented
69 interface. The available methods are:
73 =item IO::Uncompress::Brotli->B<create>
75 Returns a IO::Uncompress::Brotli instance. Please note that a single
76 instance cannot be used to decompress multiple streams.
78 =item $bro->B<decompress>(I<$block>)
80 Takes the a block of compressed data and returns a block of
81 uncompressed data. Dies on error.
87 Brotli Compressed Data Format Internet-Draft:
88 L<https://www.ietf.org/id/draft-alakuijala-brotli-08.txt>
90 Brotli source code: L<https://github.com/google/brotli/>
94 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
96 =head1 COPYRIGHT AND LICENSE
98 Copyright (C) 2015 by Marius Gavrilescu
100 This library is free software; you can redistribute it and/or modify
101 it under the same terms as Perl itself, either Perl version 5.20.2 or,
102 at your option, any later version of Perl 5 you may have available.
This page took 0.049325 seconds and 3 git commands to generate.