Compressed bytes, bzip2 streams for bytesrw
0

Configure Feed

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

OCaml 70.4%
C 18.5%
Dune 2.6%
Other 8.5%
9 1 0

Clone this repository

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

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


README.md

bytesrw-bz2#

Bzip2 compressed streams for bytesrw, using the libbz2 C library.

Overview#

Bytesrw_bz2 provides bytesrw reader and writer filters to compress and decompress bzip2 streams, with the same filter shape as the bytesrw.zlib and bytesrw.zstd libraries: decompress_reads, decompress_writes, compress_reads, compress_writes. Concatenated streams decode like the bzip2 tool handles appended files, and single-stream mode leaves the wrapped reader positioned on the leftover bytes.

Installation#

$ opam install bytesrw-bz2   # needs the libbz2 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-bz2

Usage#

# open Bytesrw;;
# let data = String.concat " " (List.init 100 string_of_int) in
  let bz = Bytes.Reader.filter_string [ Bytesrw_bz2.compress_reads () ] data in
  let back = Bytes.Reader.filter_string [ Bytesrw_bz2.decompress_reads () ] bz in
  back = data && String.length bz < String.length data;;
- : bool = true

License#

ISC -- see LICENSE.md.