mirage / decompress

Pure OCaml implementation of Zlib.
MIT License
115 stars 21 forks source link

LZMA support #48

Open XVilka opened 6 years ago

XVilka commented 6 years ago

Since it seems that ocaml-lzma is dead https://forge.ocamlcore.org/projects/ocaml-lzma/ and there are no libraries that provide a way to do that, it make sense to support it here too.

cfcs commented 6 years ago

ocaml-lzma and most of the other "OCaml" libraries that deal with compression that I've encountered so far (apart from decompress) are simply thin bindings to C implementations, so it is not just a simple case of salvaging the old OCaml code; you have to rewrite the compression/decompression algorithms from scratch. :(

Do we have a list of use cases where a LZMA implementation could come in handy?

XVilka commented 6 years ago

@cfcs I was using Ctypes bindings to the liblzma until I realized (by pain and blood) that xz-utils are not thread safe and crash all the time. Then I switch to writing OCaml bindings for LZMA SDK from 7zip, but those are a mess do deal with (mainly by API sense). I even searched for Rust implementation of LZMA (to wrap in OCaml bindings) but it turned out incomplete and unusable: https://github.com/meh/rust-lzma

cfcs commented 6 years ago

Right, but where is LZMA needed?

XVilka commented 6 years ago

This compression format is very popular.

dinosaure commented 6 years ago

I put it (a long time ago) in my TODO list. Currently, I need to finish some side projects but I will clearly take care about that soon precisely because I need:

1) rewrite some parts of decompress 2) make a release of it with gzip support 3) optimize process

XVilka commented 5 years ago

Here is the good reference in a closer (to OCaml) language (Rust) - https://github.com/gendx/lzma-rs/tree/master/src/decode

XVilka commented 4 years ago

I have a simple bindings for 7-Zip SDK in OCaml, might be some source of information too, especially regarding some arcane peculiarities: https://github.com/XVilka/ocaml-lzma_7z

XVilka commented 4 years ago

In case there will be some interest, there are some test files to check against: https://github.com/xz-mirror/xz/tree/master/tests/files