Compress::LZString - LZ-based compression library
use Compress::LZString; my $plain_text = "Hello, world."; my $compressed = compress_b64_safe($plain_text); # BIUwNmD2A0AEDukBOYAmA6IA my $decompressed = decompress_b64_safe($compressed); # Hello, world.
Compress::LZString is a perl implementation of lz-string, a fast LZ-based compression library written in javascript. It is designed to fulfill the need of storing large amounts of data in browser's localStorage, specifically on mobile devices.
$compressed = compress($plain_text);
Compresses the given text and returns the result set of bytes.
$compressed = compress_b64($plain_text);
Returns a human-readable text stream encoded in base64.
$compressed = compress_b64_safe($plain_text);
Returns a text stream encoded in base64 with a few characters replaced to make sure the result URI safe, which is ready to be sent to web servers.
Decompresses the binary/text stream processed by the function compress, compress_b64, compress_b64_safe, respectively.
compress
compress_b64
compress_b64_safe
Synonyms of compress_b64, compress_b64_safe, decompress_b64, decompress_b64_safe, respectively. If you'd like to use the exactly same function names as is in the JS version of lz-string, you can simply import these functions and play with them.
decompress_b64
decompress_b64_safe
This is a port of lz-string v.1.4.4 javascript code to perl.
pieroxy/lz-string (released under the MIT License)
Lucia Poppová <popp@cpan.org>
Copyright (C) 2021 by Lucia Poppová
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.28.1 or, at your option, any later version of Perl 5 you may have available.
To install Compress::LZString, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Compress::LZString
CPAN shell
perl -MCPAN -e shell install Compress::LZString
For more information on module installation, please visit the detailed CPAN module installation guide.