Function cacache::copy_hash

source ·
pub async fn copy_hash<P, Q>(cache: P, sri: &Integrity, to: Q) -> Result<u64>
where P: AsRef<Path>, Q: AsRef<Path>,
Expand description

Copies a cache data by hash to a specified location. Returns the number of bytes copied.

§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 world").await?;
    cacache::copy_hash("./my-cache", &sri, "./data.txt").await?;
    Ok(())
}