High-level bzip2 bindings for perl6
Switch branches/tags
Nothing to show
Clone or download
Latest commit 6b42407 Mar 17, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib/Compress Improve heuristic to guess buffer size Mar 17, 2018
t Support of stream class. Jan 19, 2016
.travis.yml Use zef instead of panda May 17, 2017
LICENSE Init Jan 12, 2016
META6.json Bump version Mar 17, 2018
README.md Support of stream class. Jan 19, 2016

README.md

perl6-Compress-Bzip2 Build Status

Bindings to bzip2 library. Procedural API is as easy as pie: you can compress and decompress your files like this:

compress($filename);
decompress($filename);

If you want to make a simple "from Buf to Buf" (de)compressing, you should use something like this:

my buf8 $result = compressToBlob($data); # Data should be encoded.
# or
my Str $result = decompressToBlob($compressed-data).decode;

Also, now we support streaming:

my $compressor = Compress::Bzip2::Stream.new;
loop {
     $socket.write($compressor.compress($data-chunk));
}
$socket.write($compressor.finish);

my $dcompressor = Compress::Bzip2::Stream.new;
while !$dcompressor.finished {
      my $data-chunk = $dcompressor.decompress($socked.read($size));
}

Your any suggestions, reporting of issues and advices about design of library will be really helpful.

I'm very grateful to authors of perl6 bindings to zlib compression library, since I took their code as example for this work and wrote very similar interface.

TODO

  • Docs.