Skip to main content

read_file_segment

Function read_file_segment 

Source
pub fn read_file_segment(
    path: &Path,
    offset: u64,
    length: u64,
    max_file_size: u64,
) -> Result<Vec<u8>>
Expand description

Read a specific segment of a file

This function reads a specific segment of a file using memory mapping or direct I/O, depending on the segment size.

§Arguments

  • path - Path to the file
  • offset - Starting offset in bytes
  • length - Length of segment to read in bytes
  • max_file_size - Maximum allowed file size

§Returns

A vector containing the file segment contents

§Errors

Returns an error if the file cannot be read or exceeds the size limit