wasm-pack 0.14.0

📦✨ your favorite rust -> wasm workflow tool!
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::fs::File;
use std::io::Read;
use std::path::Path;

use anyhow::Result;

pub fn read_file(path: &Path) -> Result<String> {
    let mut file = File::open(path)?;
    let mut contents = String::new();
    file.read_to_string(&mut contents)?;

    Ok(contents)
}