Module zstd_file

Source
Expand description

ZSTD compression and transparent decompression for files

Traits§

SendRead

Functions§

compress_file
If quiet is false, lets messaging by the zstd tool show up on stdout/err. If true, silences reporting output but captures error messages and reports those in the resulting error.
decompressed_file
Transparently decompress zstd files if they have a .zstd suffix; after that, expecting the expected_suffix (which must be given without a leading dot) if given.
decompressed_file_mmap
Open the file as a mmap. .zstd files are first decompressed to uncompressed_path (or .zstd.uncompressed if not given) if the path does not exist already. The MMap is created using 2MB huge-pages on Linux. The usual caveats for memory maps applies: modifications of the file while using the map can change the data during parsing, which is safe or not depending on the parser. Truncating the file while accessing it will segfault the process. Leaving it marked safe here, for now.