X-Git-Url: http://git.ieval.ro/?p=io-compress-brotli.git;a=blobdiff_plain;f=lib%2FIO%2FUncompress%2FBrotli.pm;fp=lib%2FIO%2FUncompress%2FBrotli.pm;h=75798a2703ed5a178d3a66b3518813ec8e939caa;hp=674f44aac5443019d26c02df8e27ece045081fb2;hb=56bfd9c0a0380461b810f820869768f4e8a7ad4a;hpb=390e0fef70ee97b173f25b04ce6308c572a0660a diff --git a/lib/IO/Uncompress/Brotli.pm b/lib/IO/Uncompress/Brotli.pm index 674f44a..75798a2 100644 --- a/lib/IO/Uncompress/Brotli.pm +++ b/lib/IO/Uncompress/Brotli.pm @@ -26,8 +26,8 @@ IO::Uncompress::Brotli - Read Brotli buffers/streams use IO::Uncompress::Brotli; - # uncompress a buffer - my $decoded = unbro $encoded; + # uncompress a buffer (yielding at most 10MB) + my $decoded = unbro $encoded, 10_000_000; # uncompress a stream my $bro = IO::Uncompress::Brotli->create; @@ -51,13 +51,12 @@ function. =over -=item B(I<$input>) +=item B(I<$input>, I<$maximum_decoded_size>) Takes a whole compressed buffer as input and returns the decompressed -data. This function relies on the BrotliDecompressedSize function. In -other words, it only works if the buffer has a single meta block or -two meta-blocks where the first is uncompressed and the second is -empty. +data. It allocates a buffer of size I<$maximum_decoded_size> to store +the decompressed data, if this is not sufficient (or there is another +error) this function will croak. Exported by default.