Something went wrong. Try again.
Compressed bytes, brotli streams for bytesrw
Something went wrong. Try again.
Files
- OCaml 85%
- C 15%
README.md
bytesrw-brotli #
Brotli compressed streams for bytesrw, using the libbrotli C libraries.
Brotli (RFC 7932) is the br content coding of HTTP, and a client that
advertises it must be able to decode it. Bytesrw_brotli provides
bytesrw reader and writer filters that compress and decompress brotli
streams through the libbrotli C libraries. The filters have the same shape as
those of the bytesrw.zlib and bytesrw.zstd libraries: decompress_reads,
decompress_writes, compress_reads and compress_writes.
Installation #
$ opam install bytesrw-brotli # requires the libbrotli C libraries
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-brotli
Usage #
Compress a string and decompress it back:
# open Bytesrw;;
# let data = String.concat " " (List.init 100 string_of_int) in
let z = Bytes.Reader.filter_string [ Bytesrw_brotli.compress_reads () ] data in
let back = Bytes.Reader.filter_string [ Bytesrw_brotli.decompress_reads () ] z in
back = data && String.length z < String.length data;;
- : bool = true
Licence #
ISC. See LICENSE.md.