Skip to main content

Module compression

Module compression 

Source

Structs§

ForwardText
The text of one file, read from the front.

Enums§

ByteSource
Bytes of one file, mapped when a plain file is large enough.
Compression
Detected compression format based on magic bytes.
FileContents
Holds file contents either as an owned String or a memory-mapped region.

Constants§

GZIP_LEVEL
zlib/gzip level used for CON payloads.
MMAP_THRESHOLD
Size in bytes from which read_file_contents maps an uncompressed file. A smaller one is read into a String.
ZSTD_LEVEL
zstd level used for CON payloads. Level 3 is the zstd CLI default.

Functions§

advise_dontneed_parallel
Drop resident pages of map on workers threads, then the caller unmaps. Each thread advises a disjoint byte range. The page size is sysconf(SC_PAGESIZE), not a host-tuned cutoff.
codec_deflate
Deflate plain into members slices on threads workers.
codec_inflate
Inflate a gzip or zstd buffer with threads workers and no CON parse.
compression_workers
How many independent compression members a payload of nbytes uses.
default_deflate_threads
Deflate workers for a write that did not ask for a thread count.
detect_compression
Detect compression format from the first bytes of a file.
detect_compression_from_extension
Detect compression format from a file extension.
gzip_writer
Creates a gzip-compressed writer wrapping a file at the given path.
open_decoded
The bytes of path as one stream, decompressed while it is read.
read_bytes_owned
Load path for a parse. See ByteSource.
read_file_bytes
File bytes in one read when the file is not compressed.
read_file_contents
Reads file contents, decompressing if needed.
read_file_contents_detected
read_file_contents, also returning the compression it detected.
read_file_text
read_file_contents as one owned String. An uncompressed file is read into it at any size instead of being mapped, so the text is held once and later changes to the file do not reach it.
with_decode_threads
Run body with indexed members inflated on at most threads workers.
with_serial_decode
Run body with multi-member inflation forced onto one thread.
write_fused_gzip_frame
write_gzip_members_n with a separate worker count.
write_gzip_members
Writes data as gzip members at GZIP_LEVEL.
write_gzip_members_limited
write_gzip_members_n
write_gzip_members with an explicit member count.