Skip to main content

Crate wgame_fs

Crate wgame_fs 

Source
Expand description

Cross-platform file reading utilities.

Provides async file reading for both desktop (std) and web platforms. Native paths are relative to the process working directory; web paths are URLs relative to the page. Embed bytes when assets must work from any directory.

§Examples

use wgame_fs::{read_bytes, read_string};

async fn example() -> anyhow::Result<()> {
    // Read file as bytes
    let bytes = read_bytes("assets/image.png").await?;
     
    // Read file as string
    let text = read_string("assets/config.json").await?;
     
    Ok(())
}

Type Aliases§

Path
PathBuf