Compressed bytes, xz streams for bytesrw
0

Configure Feed

Select the types of activity you want to include in your feed.

OCaml 74.0%
C 14.1%
Dune 2.7%
Other 9.2%
9 1 0

Clone this repository

https://git.vm.fail/gazagnaire.org/ocaml-bytesrw-xz https://git.vm.fail/did:plc:qcgvbnilmo57qcg6o56btput
ssh://git@git.recoil.org:2222/gazagnaire.org/ocaml-bytesrw-xz ssh://git@git.recoil.org:2222/did:plc:qcgvbnilmo57qcg6o56btput

For self-hosted knots, clone URLs may differ based on your setup.


README.md

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.