package bytesrw
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=e3f07dbd808e152cd4b2ea5c2fa3863d4b72f7f97cfa3cd7493a3725c84f39d882042388ee47c9d6acfd30a650c21db429c8264db3d7466cad6e580308b5a2d2
doc/bytesrw.zlib/Bytesrw_zlib/Gzip/index.html
Module Bytesrw_zlib.Gzip
Source
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
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).
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
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
).
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).