package decompress
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=34a04176a42955ce529a1b57e8b225e7cf63680e49dd8ad05b3fe463bc7863bd
sha512=cfc300cbf620563453ca166e5a53fde3317c8a24ce3010a5cdee080f51cca26c67f658e57bd8feee582c7dcb459a692010b90907ae2e9ba9fe494d5da5d88c13
Description
Decompress is an implementation of Zlib in OCaml
It provides a pure non-blocking interface to inflate and deflate data flow.
Published: 26 Sep 2019
README
Decompress - Pure OCaml implementation of Zlib
Decompress is a pure implementation of zlib. The goal is to create an available package for Mirage OS which implements zlib in OCaml (instead a C code).
We respect the interface of zlib and all flush mode is available (experimental):
syncperforms the following tasks:
- if there is some buffered but not yet compressed data, then this data is compressed into one or several blocks
- a new type 0 block with empty contents is appended
partialis a deprecated flush methodfullis a variant of thesyncmethod flush. The difference lies in the LZ77 step. The full flush is a sync flush where the dictionary is emptied: after a full flush, the deflater will refrain from using copy symbols which reference sequences appearing before the flush point.
The interface proposed is a non-blocking interface.
Home page: http://din.osau.re/
Contact: Romain Calascibetta <romain.calascibet ta@gmail.com>
Installation
Decompress can be installed with opam:
opam install decompressCheckseum & Optint, linking with Decompress
From benchmarks, the biggest bottleneck of decompress seems to be the computation of the ADLER-32. From this acknowledge, we decide to externalize this part of decompress to 2 sub-libraries: checkseum and optint.
checkseum (and, by this way, decompress) uses a trick about linking and let the end-user to choose which implementation he wants. We provide 2 implementations: checkseum.c and checkseum.ocaml. Currently, decompress does not choose an implementation.
When you want to use decompress, you must choose which implementation you want and link with decompress and checkseum.{c,ocaml}.
NOTE: currently the end-user need to put checkseum.{c,ocaml} as the first dependency before decompress in dune file, like:
(executable
((name ...)
(libraries (checkseum.c decompress))))Otherwise, the end-user should have a linking error (see #47).
RFC 1951
This distribution provides an implementation of zlib and an implementation of RFC 1951 - which is a subset of zlib. You can use both if you link with decompress - or just use the RFC 1951 implementation by the rfc1951 package.
The biggest difference between zlib and rfc1951 is:
- no header
- input/output is not aligned on byte
- no checksum
Sample programs
A good example is provided in bin/easy.ml with the signature:
val compress : ?level:int -> string -> string
val uncompress : string -> stringAnd you can compile this program with:
ocamlbuild -use-ocamlfind -package checkseum.c,decompress bin/easy.nativeBut keep in your mind, it's an easy example and it's not optimized for a productive environment - so, don't copy/paste and think.
Build Requirements
- OCaml >= 4.03.0
base-bytesmeta-package- Bigarray module (provided by the standard library of OCaml)
duneto build the projectcheckseum&optintto compute ADLER-32 checksum
Dependencies (7)
- fmt
-
checkseum
>= "0.1.1" -
optint
>= "0.0.3" - bigarray-compat
- base-bytes
- dune
-
ocaml
>= "4.07.0"
Dev Dependencies (3)
-
hxd
with-test & < "0.3.0" -
alcotest
with-test -
bigstringaf
with-test
Conflicts
None