Skip to content

Altai-man/perl6-Compress-Bzip2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

perl6-Compress-Bzip2 Linux MacOS Windows

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.