Skip to content

retupmoca/P6-Compress-Zlib-Raw

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
t
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Compress::Zlib::Raw

Build Status Build status

Low-level interface to zlib.

Note: This will probably only work on 64bit *nix, due to hardcoded library name and sizeof numbers.

##Example

use v6;

use Compress::Zlib::Raw;
use NativeCall;

my $to-compress = "test".encode;

my $return-buf-len = CArray[long].new;
$return-buf-len[0] = 128;

my $return-buf = buf8.new;
$return-buf[127] = 0;

my $result = compress($return-buf, $return-buf-len, $to-compress, 4);
die if $result != Compress::Zlib::Raw::Z_OK;

my $orig-buf = buf8.new;
$orig-buf[127] = 1;

my $orig-size = CArray[long].new;
$orig-size[0] = 128;

$result = uncompress($orig-buf, $orig-size, $return-buf, $return-buf-len[0]);
die if  $result != Compress::Zlib::Raw::Z_OK;

Author

Andrew Egeler, retupmoca on #perl6, https://github.com/retupmoca/

License

MIT License

About

Low-level interface to zlib

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Other 100.0%