- First release
You can also:
- decode & encode files from brotli compress to uncompress or uncompress to brotli compress.
- use this source to build your own application.
Brotli is a generic-purpose lossless compression algorithm that compresses data using a combination of a modern variant of the LZ77 algorithm, Huffman coding and 2nd order context modeling, with a compression ratio comparable to the best currently available general-purpose compression methods. It is similar in speed with deflate but offers more dense compression. Brotli Github
Haxe is an open source toolkit that allows you to easily build cross-platform tools and applications that target many mainstream platforms. Haxe Github
BrotliHaxe author Dominik Homberger:
Build & Execute
BrotliHaxe requires Haxe 3.x when you want compile code. (I already put generated source to this git)
Important! This four files must be in the build dir:
If you upload the files to webserver then change to binary else you get error while decoding & encoding.
For using as lib see source code at https://dominikhlbg.github.io/brotlijs/
$ haxe -cp src -php ./php/ -main Main $ php ./php/index.php
$ haxe -cp src -python ./python/brotli.py -main Main $ python ./python/brotli.py
$ haxe -cp src -java ./java/ -main Main $ java -jar ./java/Main.jar
$ haxe -cp src -cs ./cs/ -main Main
$ not implemented yet
Implement as Lib
Include the Brotli named file. (Java path: src/haxe/root/ else src/ or filename self)
Build new Brotli()
var brotli = new Brotli();
You have four option. First both are string version.
var decompressedstring = brotli.decompress(compressedstring);
var compressedstring = brotli.compress(decompressedstring, quality); //quality [1...11]
The last two are byte array. [0...255]
var decompressedbytearray = brotli.decompressArray(compressedbytearray);
var compressedbytearray = brotli.compressArray(decompressedbytearray, quality); //quality [1...11]
Here you can see a small benchmark on an i7 2600k CPU.
Brotli Benchmark -q 1 plrabn12.txt
(ms) lower is better
This source code base on a nearly two years old brotli version but still works good. I'm update to actually soon.
I'm looking for optimise the different outputs. Maybe you can help? Great! But the source code shouldn't looks different from the original source code because that makes updating difficult.
- update to last brotli version
- remove main build for library version
See license file and if you like you can add my name.
That is my first source code that I release under MIT!