Function cacache::read_hash_sync

source ·
pub fn read_hash_sync<P>(cache: P, sri: &Integrity) -> Result<Vec<u8>>
where P: AsRef<Path>,
Expand description

Reads the entire contents of a cache file synchronously into a bytes vector, looking the data up by its content address.

§Example

use std::io::Read;

fn main() -> cacache::Result<()> {
    let sri = cacache::write_sync("./my-cache", "my-key", b"hello")?;
    let data = cacache::read_hash_sync("./my-cache", &sri)?;
    Ok(())
}