Skip to main content

read_file

Function read_file 

Source
pub fn read_file(
    file_path: &str,
    allowed_dirs: &[String],
    opts: &ReadFileOpts<'_>,
) -> String
Expand description

Read a file with path-traversal protection.

Returns the file content as a formatted string with line numbers. Every code path returns a status string — invalid path, read failure, successful content — all surface as String; pyo3 wrappers convert to Py<str> automatically.