deflatex

This library provides implementation for deflate and inflate algorithms using pure Haxe.
https://github.com/4as/haxe-deflatex

To install, run:

haxelib install deflatex 1.0.0 

See using Haxelib in Haxelib documentation for more information.

README.md

DeflateX is a Haxe port of the deflate implementation written by RidgeX (hence the "X" in the name). Written purely in Haxe without any additional dependencies, it compiles to all available targets, but was tested only for JS, Flash, C++ (Windows), C# (Windows), PHP, Java, and HashLink.

Usage

DeflateX can be used to apply both deflate and inflate algorithms, but also to compress and decompress gzip file format.
Using DeflateX is pretty straightforward. If you want to compress a byte array simply pass it into the static Deflater.apply method. var test:String = "Test data 123";
var test_bytes:Bytes = Bytes.ofString(test);
var compressed:Bytes = Deflater.apply(test_bytes);;
However, in case you're working in a multi-threaded environment and want to run multiple deflate operations in parallel, you can also instantiate a unique Deflater object and call compress method instead:
var deflater:Deflater = new Deflater();
var compressed:Bytes = deflater.compress(test_bytes);

Once a byte array is deflated you can decompress it using the static Inflater.apply method:
var decompressed:Bytes = Inflater.apply(compressed);
var result:String = decompressed.getString(0, decompressed.length);
trace(result); //following the Usage steps this should output "Test data 123"
Or similarly as with Deflater by instating the Inflater object and calling the decompress method:
var inflater:Inflater = new Inflater();
var decompressed:Bytes = inflater.decompress(compressed);

Contributors
4as
Version
1.0.0
Published
4 years ago
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub

⌂