Giter Site home page Giter Site logo

perl6-compress-bzip2's Introduction

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.

perl6-compress-bzip2's People

Contributors

altai-man avatar pmqs avatar samcv avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

samcv pmqs

perl6-compress-bzip2's Issues

Decompression rate up to 2x times failes

Look at this sub:

our sub internalBlobToBlob(buf8 $data, $compressing) {
    my buf8 $temp .= new;
    my uint32 $len;
    given $data.elems {
	when 0..50 {
	    $len = 1024; # Numbers need check.
	}
	default {
	    $len = $data.elems*2;
	}
    }

You create temp buffer for decompressed data only up to 2x bigger then the source one. Why do you think compression more then 2x times impossible??? E.g. I compressing html files which compressed up to 5-7x times.

Now I got error:
Output buffer is definetly smaller than source. Check size of your file or report an error.

[Installation] Cannot locate native library 'libbz2.1.dylib'

Installation appears to fail on macOS 10.13.6 with a missing library libbz2.1.dylib

$ zef install Compress::Bzip2
===> Searching for: Compress::Bzip2
===> Searching for missing dependencies: Compress::Bzip2::Raw
===> Testing: Compress::Bzip2::Raw:ver<0.2.2>:auth<zef:Altai-man>
===> Testing [OK] for Compress::Bzip2::Raw:ver<0.2.2>:auth<zef:Altai-man>
===> Testing: Compress::Bzip2:ver<0.4.1>:auth<zef:Altai-man>
[Compress::Bzip2] # Failed test 'Compression was done.'
[Compress::Bzip2] # at t/10-basic.t line 12
[Compress::Bzip2] # Cannot locate native library 'libbz2.1.dylib': dlopen(libbz2.1.dylib, 10): image not found

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.