Skip to main content

read_input_file_any_path

Function read_input_file_any_path 

Source
pub async fn read_input_file_any_path<P: AsRef<Path>>(
    file_path: P,
) -> Result<FileInputData>
Expand description

Read a validated local file path for inline model input.

Callers must validate path scope and user intent before using this helper.

Stat, read, and base64 encoding all happen inside one spawn_blocking segment. tokio::fs would run the stat and read as two separate hops onto the shared blocking pool, and base64-encoding up to 50 MiB on a runtime worker would be a long poll that stalls I/O — both patterns the fast-Tokio guidance calls out (“batch a series of filesystem operations into the largest sensible blocking segment”).