Skip to main content

read_file_with_limit

Function read_file_with_limit 

Source
pub fn read_file_with_limit(path: &Path) -> Result<String>
Expand description

Reads a file with size limits to prevent memory exhaustion

§Security Checks

  • File size limit enforced (max 10MB)
  • Prevents reading extremely large files into memory
  • Returns error if file exceeds size limit

§Arguments

  • path - Path to file to read

§Returns

  • Ok(String) if file is within size limit
  • Err(io::Error) if file exceeds limit or cannot be read