Expand description
Smart file reading with memmap2 for large files. Smart file reading with automatic memmap2 for large files.
Files above MMAP_THRESHOLD are memory-mapped via the kernel page cache,
then copied to a Vec<u8> because callers require ownership for mutation.
For read-only use cases (e.g., checksumming), prefer crate::checksum::hash_file
which operates directly on the mmap without copying.
Functions§
- read_
file_ bytes - Read a file as raw bytes, using mmap for files above the threshold.
- read_
file_ string - Read a file as a UTF-8 string, using mmap for files above the threshold.