bytesrw-xz#
Xz compressed streams for bytesrw, using the liblzma C library.
Overview#
Bytesrw_xz provides bytesrw reader and writer filters to compress and
decompress xz streams, with the same filter shape as the bytesrw.zlib
and bytesrw.zstd libraries: decompress_reads, decompress_writes,
compress_reads, compress_writes. Concatenated streams and the padding
between them decode like the xz tool handles appended files, and
single-stream mode leaves the wrapped reader positioned on the leftover
bytes.
Installation#
$ opam install bytesrw-xz # needs the liblzma C library
If opam cannot find the package, it may not yet be released in the public
opam-repository. Add the overlay repository, then install it:
$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install bytesrw-xz
Usage#
# open Bytesrw;;
# let data = String.concat " " (List.init 100 string_of_int) in
let z = Bytes.Reader.filter_string [ Bytesrw_xz.compress_reads () ] data in
let back = Bytes.Reader.filter_string [ Bytesrw_xz.decompress_reads () ] z in
back = data && String.length z < String.length data;;
- : bool = true
License#
ISC -- see LICENSE.md.