Function cacache::copy_sync

source ·
pub fn copy_sync<P, K, Q>(cache: P, key: K, to: Q) -> Result<u64>
where P: AsRef<Path>, K: AsRef<str>, Q: AsRef<Path>,
Expand description

Copies a cache entry by key to a specified location. Returns the number of bytes copied.

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

§Example

use std::io::Read;

fn main() -> cacache::Result<()> {
    cacache::copy_sync("./my-cache", "my-key", "./my-hello.txt")?;
    Ok(())
}