Compre...::Zstd(3pm)

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

✨ Compress::Stream::Zstd β€” the Perl glow-up for Zstd πŸ’…

okay so bestie, picture this: it's a Perl module page from the User Contributed Perl Documentation corner of the manpage universe, and it's literally the Perl interface to the Zstd (Zstandard) (de)compressor πŸ¦‹ that's the whole NAME vibe, periodt.


🌸 NOTE

so this module is a fork of Compress-Zstd <https://github.com/spiritloose/Compress-Zstd> β€” yes, a fork, we said what we said 🍴

it's got a few changes in there to make streaming compression/uncompression more robust (the way that robustness ate, fr fr πŸ’…). and the only reason this fork exists? to let the module work with IO-Compress-Zstd 🫢 that's it, that's the whole motivation.

and the hope β€” the dream, the main character energy ✨ β€” is that the changes made here can be merged back upstream and this module can be retired. retiring a fork because it got adopted upstream is genuinely iconic behavior πŸ‘‘


✨ SYNOPSIS ✨

use Compress::Stream::Zstd;

my $compressed = compress($bytes);
my $decompressed = decompress($compressed);

like, that's it. two lines and you're slaying 😌


πŸŽ€ DESCRIPTION πŸŽ€

The Compress::Stream::Zstd module provides an interface to the Zstd (Zstandard) (de)compressor. no cap, that's the entire description, it's a short king but it delivers πŸ’–


πŸ”₯ FUNCTIONS πŸ”₯

πŸ’œ compress($source [, $level])

Compresses the given buffer and returns the resulting bytes πŸ’« the input buffer can be either a scalar or a scalar reference β€” either one works, we're flexible like that.

on error, undef is returned 😭 so always check, bestie.

πŸ’œ decompress($source) 🌈 uncompress($source)

Decompresses the given buffer and returns the resulting bytes ✨ again, the input buffer can be either a scalar or a scalar reference.

on error (in case of corrupted data) undef is returned πŸ’€ corrupted data is not the vibe, guard your return values.

⭐ CONSTANTS ⭐

these lil guys are just sitting there being constants, and honestly? obsessed:

  • ZSTD_VERSION_NUMBER
  • ZSTD_VERSION_STRING
  • ZSTD_MAX_CLEVEL
  • ZSTD_MIN_CLEVEL

πŸ¦‹ SEE ALSO πŸ¦‹

<http://www.zstd.net/> β€” go say hi to the upstream, iykyk 🌐


πŸ‘‘ LICENSE πŸ‘‘

okay legal moment, stay with me, this part is verbatim important πŸ“œ

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.

bestie please actually read it, it's giving very "no warranty, use at your own risk" πŸ’€


🌸 AUTHOR 🌸

  • Jiro Nishiguchi <jiro@cpan.org> πŸ’–
  • Some streaming enhancement by Paul Marquess <pmqs@cpan.org> ✨
  • Zstandard by Facebook, Inc. πŸ”₯

aaaand that's the page! πŸŽ€ this drop is perl v5.40.0, dated 2024-07-18, straight from the Compre...::Zstd(3pm) files β€” mwah, go compress something, ily πŸ«ΆπŸ’œ

πŸ“¦ where this page comes from