package bytesrw
Install
Dune Dependency
Authors
Maintainers
Sources
sha512=fd1ee852cf9d8c3b1800d4927c18453b18385b49354fb3ea71ae08f1ca640741c0594863c5db339432da55a9ee42e4fdbc8d6ef0afe29a375aac1ec6cee11c0b
doc/bytesrw.zlib/Bytesrw_zlib/Gzip/index.html
Module Bytesrw_zlib.Gzip
gzip
streams.
Note. In general a gzip
stream can be made of multiple, independently compressed, members. The way the module handles gzip
member headers is described here.
Decompress
val decompress_reads : ?all_members:bool -> unit -> Bytesrw.Bytes.Reader.filter
decompress_reads () r
filters the reads of r
by decompressing gzip
members. If all_members
is
true
(default), this concatenates decompressed sequences ofgzip
members likegunzip
would do and errors if there is leftover data.false
this decompresses a singlegzip
member. Once the resulting reader returnsBytesrw.Bytes.Slice.eod
,r
is positioned exactly after the end of the gzip member and can be used again to perform other non-filtered reads (e.g. a newgzip
member or other unrelated data).
val decompress_writes : unit -> Bytesrw.Bytes.Writer.filter
decompress_writes () w ~eod
filters the writes on w
by decompressing sequences of gzip
members until Bytesrw.Bytes.Slice.eod
is written. If eod
is false
, the latter is not written on w
and at this point w
can be used again to perform other non-filtered writes.
Compress
val compress_reads : ?level:level -> unit -> Bytesrw.Bytes.Reader.filter
compress_reads ~level () r
filters the reads of r
by compressing them to as a single gzip
member at level level
(defaults to default_compression
).
val compress_writes : ?level:level -> unit -> Bytesrw.Bytes.Writer.filter
compress_writes ~level () w ~eod
filters the writes on w
by compressing them to a single gzip
member at level level
(defaults to default_compression
) until Bytesrw.Bytes.Slice.eod
is written. If eod
is false
the latter is not written on w
and at this point w
can be used again to perform other non-filtered writes.
Member headers
Currently no facility is provided to access gzip
member headers. It seems those are little used in practice. However support is provided to read and write gzip
streams member-by-member which is used by certain formats.
On compression the member's header generated in the stream is zlib
's default header; see documentation of deflateSetHeader
in the the manual. Note that this watermarks the operating system in the stream (at least in v1.3.1 as of writing).