Compre...ressor(3pm)

πŸ“¦
version 0.206 Β· 4 versions
, in epel 10

πŸ’œ 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