[][src]Function cacache::read_hash

pub async fn read_hash<'_, P>(cache: P, sri: &'_ Integrity) -> Result<Vec<u8>> where
    P: AsRef<Path>, 

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

Example

use async_std::prelude::*;
use async_attributes;

#[async_attributes::main]
async fn main() -> cacache::Result<()> {
    let sri = cacache::write("./my-cache", "my-key", b"hello").await?;
    let data: Vec<u8> = cacache::read_hash("./my-cache", &sri).await?;
    Ok(())
}