NAME

Compress::LZString - LZ-based compression library

SYNOPSIS

use Compress::LZString;

my $plain_text = "Hello, world.";
my $compressed = compress_b64_safe($plain_text);      # BIUwNmD2A0AEDukBOYAmA6IA
my $decompressed = decompress_b64_safe($compressed);  # Hello, world.

DESCRIPTION

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.

FUNCTIONS

compress

$compressed = compress($plain_text);

Compresses the given text and returns the result set of bytes.

compress_b64

$compressed = compress_b64($plain_text);

Returns a human-readable text stream encoded in base64.

compress_b64_safe

$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.

decompress

decompress_b64

decompress_b64_safe

Decompresses the binary/text stream processed by the function compress, compress_b64, compress_b64_safe, respectively.

compressToBase64

compressToEncodedURIComponent

decompressFromBase64

decompressFromEncodedURIComponent

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.

VERSION

This is a port of lz-string v.1.4.4 javascript code to perl.

SEE ALSO

pieroxy/lz-string (released under the MIT License)

AUTHOR

Lucia Poppová <popp@cpan.org>

COPYRIGHT AND LICENSE

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.