decompress icon indicating copy to clipboard operation
decompress copied to clipboard

LZMA support

Open XVilka opened this issue 5 years ago • 8 comments

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.

XVilka avatar Aug 17 '18 06:08 XVilka

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?

cfcs avatar Oct 22 '18 12:10 cfcs

@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

XVilka avatar Oct 22 '18 12:10 XVilka

Right, but where is LZMA needed?

cfcs avatar Oct 22 '18 16:10 cfcs

This compression format is very popular.

XVilka avatar Oct 30 '18 11:10 XVilka

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

dinosaure avatar Oct 30 '18 12:10 dinosaure

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

XVilka avatar Nov 15 '19 07:11 XVilka

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 avatar Mar 26 '20 11:03 XVilka

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

XVilka avatar Jun 17 '20 07:06 XVilka