Low-level interface to zlib
Switch branches/tags
Nothing to show
Latest commit ee33050 Jun 15, 2017 @retupmoca committed on GitHub Merge pull request #16 from zoffixznet/patch-1
Use modern META filename
Failed to load latest commit information.
examples Updated README with more documentation added an examples folder Apr 12, 2016
lib/Compress/Zlib For some inexplicable reason the 'return' here gives rise to a Nov 19, 2016
resources Rename to standard location Apr 12, 2016
t s/int/long/ Apr 4, 2015
.gitignore Ignore .precomp Apr 12, 2016
.travis.yml Test on 2016.03 (Travis CI) Apr 14, 2016
LICENSE Initial commit Nov 30, 2013
META6.json Use modern META filename Apr 25, 2017
README.md Fix example syntax highlighting Apr 14, 2016



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.


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;


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


MIT License