Compre...ressor(3pm)
π Compress::Stream::Zstd::Decompressor β the Compre...ressor(3pm) page, bestie edition π¦
Okay so picture this: you've got Zstd-compressed bytes streaming at you and you need to decompress them as they arrive, not all at once like some kind of patient person. That's literally this module. It's from the Perl User Contributed Perl Documentation, and it's the streaming decompressor half of Compress::Stream::Zstd. Let's get into it β¨
πΈ NAME πΈ
Compress::Stream::Zstd::Decompressor β Zstd streaming decompression, no cap π
π SYNOPSIS π
Here's the whole vibe in one go:
use Compress::Stream::Zstd::Decompressor qw(ZSTD_DSTREAM_IN_SIZE);
my $decompressor = Compress::Stream::Zstd::Decompressor->new;
while (read($fh, my $buffer, ZSTD_DSTREAM_IN_SIZE)) {
print $decompressor->decompress($buffer);
}
Like β make one, then keep feeding it chunks and printing out what comes back. That's it. That's the whole loop. Iconic π«Ά
β¨ DESCRIPTION β¨
The Compress::Stream::Zstd::Decompressor module provides a streaming interface to the Zstd decompressor. Streaming!! Meaning you don't have to hold the whole thing in memory first. She's chill like that π
π¦ METHODS π¦
π Compress::Stream::Zstd::Decompressor->new()
Return type: :Compress::Stream::Zstd::Decompressor
Creates an instance of Compress::Stream::Zstd::Decompressor. Your main character. Your new bestie. Go say hi π
π $decompressor->init()
Return type: :Undef
(re)init the decompressor. Yes, the "(re)" is doing real work there β she can be re-initialised, that's the whole point. Fresh start energy π§
π $decompressor->decompress($input)
Return type: :Str
Consumes the input stream. You hand her a chunk, she hands you back a string. Feed her again, she'll keep going. That's the streaming part, bestie π
π $decompressor->set_parameter( PARAMETER => VALUE )
Sets one of the decompressor's internal parameters. PARAMETER is one of the parameter constants listed down below π (yes, there's a whole section for them, keep scrolling).
β CONSTANTS β
π ZSTD_DSTREAM_IN_SIZE
The recommended size for the input buffer. Use this in your read() calls and you literally cannot go wrong, that's the whole point of a recommendation π«
π PARAMETER CONSTANTS π
The following may be given to set_parameter():
"ZSTD_d_windowLogMax"
That's the list. One item. She's a short list but she matters π₯
π SEE ALSO π
Compress::Stream::Zstd
Go check out the parent module, she's got the whole family tree π«Ά
π LICENSE π
Alright bestie, legal time. This is verbatim, don't @ me π
Copyright (c) 2016, Jiro Nishiguchi
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
π AUTHOR π
Jiro Nishiguchi <jiro@cpan.org>
Zstandard by Facebook, Inc.
Bestie please note: the warranty disclaimer above is the real deal β it's provided "AS IS", with no warranty of any kind. Not being dramatic, that's genuinely what it says π
And that's the page!! Made with love on 2024-07-18, shipped as part of perl v5.40.0 β catch you in the next manpage, mwah ππ
π¦ where this page comes from
- epel 10: perl-Compress-Stream-Zstd 0.206-7.el10_0 Β· BSD-2-Clause AND BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms