Skip to main content

read_file_bytes_effect

Function read_file_bytes_effect 

Source
pub fn read_file_bytes_effect<Env>(
    path: PathBuf,
) -> impl Effect<Output = Vec<u8>, Error = AnalysisError, Env = Env>
where Env: AnalysisEnv + Clone + Send + Sync + 'static,
Expand description

Read a file’s contents as raw bytes.

This effect reads the entire file into memory as a byte vector. Use this for binary files or when UTF-8 validation isn’t needed.

§Arguments

  • path - The path to the file to read

§Returns

An effect that produces the file contents as bytes.

§Example

let effect = read_file_bytes_effect("image.png".into());
let bytes = effect.run(&env).await?;