[go: up one dir, main page]

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

Copies a cache data by hash to a specified location. Copied data will not be checked against the given hash.

On platforms that support it, this will create a copy-on-write “reflink” with a full-copy fallback.

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