.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "IO::Compress::Brotli 3" .TH IO::Compress::Brotli 3 2025-01-30 "perl v5.40.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME IO::Compress::Brotli \- Write Brotli buffers/streams .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use IO::Compress::Brotli; \& \& # compress a buffer \& my $encoded = bro $encoded; \& \& # compress a stream \& my $bro = IO::Compress::Brotli\->create; \& while(have_input()) { \& my $block = get_input_block(); \& my $encoded_block = $bro\->compress($block); \& handle_output_block($encoded_block); \& } \& # Need to finish the steam \& handle_output_block($bro\->finish()); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" IO::Compress::Brotli is a module that compressed Brotli buffers and streams. Despite its name, it is not a subclass of IO::Compress::Base and does not implement its interface. This will be rectified in a future release. .SS "One-shot interface" .IX Subsection "One-shot interface" If you have the whole buffer in a Perl scalar use the \fBbro\fR function. .ie n .IP "\fBbro\fR(\fR\fI$input\fR\fI\fR, \fI\fR\fI$quality\fR\fI\fR, \fI\fR\fI$window\fR\fI\fR)" 4 .el .IP "\fBbro\fR(\fR\f(CI$input\fR\fI\fR, \fI\fR\f(CI$quality\fR\fI\fR, \fI\fR\f(CI$window\fR\fI\fR)" 4 .IX Item "bro($input, $quality, $window)" Takes a whole uncompressed buffer as input and returns the compressed data using the supplied quality and window parameters. If quality and window parameters are not supplied, default values are used (as described under the object-oriented interface). .Sp Exported by default. .SS "Streaming interface" .IX Subsection "Streaming interface" If you want to process the data in blocks use the object oriented interface. The available methods are: .IP IO::Compress::Brotli\->\fBcreate\fR 4 .IX Item "IO::Compress::Brotli->create" Returns a IO::Compress::Brotli instance. Please note that a single instance cannot be used to decompress multiple streams. .ie n .IP $bro\->\fBwindow\fR(\fR\fI$window\fR\fI\fR) 4 .el .IP \f(CW$bro\fR\->\fBwindow\fR(\fR\f(CI$window\fR\fI\fR) 4 .IX Item "$bro->window($window)" Sets the window parameter on the brotli encoder. Defaults to BROTLI_DEFAULT_WINDOW (22). .ie n .IP $bro\->\fBquality\fR(\fR\fI$quality\fR\fI\fR) 4 .el .IP \f(CW$bro\fR\->\fBquality\fR(\fR\f(CI$quality\fR\fI\fR) 4 .IX Item "$bro->quality($quality)" Sets the quality paremeter on the brotli encoder. Defaults to BROTLI_DEFAULT_QUALITY (11). .ie n .IP $bro\->\fBmode\fR(\fR\fI$mode\fR\fI\fR) 4 .el .IP \f(CW$bro\fR\->\fBmode\fR(\fR\f(CI$mode\fR\fI\fR) 4 .IX Item "$bro->mode($mode)" Sets the brotli encoder mode, which can be any of "generic", "text" or "font". Defaults to "generic". .ie n .IP $bro\->\fBcompress\fR(\fR\fI$block\fR\fI\fR) 4 .el .IP \f(CW$bro\fR\->\fBcompress\fR(\fR\f(CI$block\fR\fI\fR) 4 .IX Item "$bro->compress($block)" Takes the a block of uncompressed data and returns a block of compressed data. Dies on error. .ie n .IP $bro\->\fBflush\fR() 4 .el .IP \f(CW$bro\fR\->\fBflush\fR() 4 .IX Item "$bro->flush()" Flushes any pending output from the encoder. .ie n .IP $bro\->\fBfinish\fR() 4 .el .IP \f(CW$bro\fR\->\fBfinish\fR() 4 .IX Item "$bro->finish()" Tells the encoder to start the finish operation, and flushes any remaining compressed output. .Sp Once finish is called, the encoder cannot be used to compress any more content. .Sp \&\fBNOTE\fR: Calling finish is \fBrequired\fR, or the output might remain unflushed, and the be missing termination marks. .SH "SEE ALSO" .IX Header "SEE ALSO" Brotli Compressed Data Format Internet-Draft: .PP Brotli source code: .SH AUTHOR .IX Header "AUTHOR" Marius Gavrilescu, .PP The encoder bindings, modernisation of the decoder bindings and a clean up of the overall project were contributed by: .IP "Quim Rovira, " 4 .IX Item "Quim Rovira, " .PD 0 .IP "Ævar Arnfjörð Bjarmason, " 4 .IX Item "Ævar Arnfjörð Bjarmason, " .IP "Marcell Szathmári" 4 .IX Item "Marcell Szathmári" .IP "Mattia Barbon, " 4 .IX Item "Mattia Barbon, " .PD .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2015\-2018 by Marius Gavrilescu .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.20.2 or, at your option, any later version of Perl 5 you may have available.