diff --git a/src/content/read.rs b/src/content/read.rs index 4c30286..f3a6e1e 100644 --- a/src/content/read.rs +++ b/src/content/read.rs @@ -19,3 +19,11 @@ pub fn read_to_string(cache: &Path, sri: &Integrity) -> io::Result { pub fn copy(cache: &Path, sri: &Integrity, to: &Path) -> io::Result { fs::copy(content_path(&cache, &sri), to) } + +pub fn has_content(cache: &Path, sri: &Integrity) -> Option { + if content_path(&cache, &sri).exists() { + Some(sri.clone()) + } else { + None + } +}