tauri_sys::fs

Function read_text_file

source
pub async fn read_text_file(
    path: &Path,
    dir: BaseDirectory,
) -> Result<String, Error>
Expand description

Read a file as an UTF-8 encoded string.

ยงExample

use tauri_sys::fs;

let contents = fs::readTextFile(path, BaseDirectory::Download).expect("could not read file as text");

Requires allowlist > fs > readTextFile to be enabled.