diff --git a/src/content/mod.rs b/src/content/mod.rs index cea38ba..3ef7fa1 100644 --- a/src/content/mod.rs +++ b/src/content/mod.rs @@ -1,3 +1,4 @@ pub mod path; pub mod read; pub mod write; +pub mod rm; diff --git a/src/content/rm.rs b/src/content/rm.rs new file mode 100644 index 0000000..3081cdc --- /dev/null +++ b/src/content/rm.rs @@ -0,0 +1,9 @@ +use crate::content::path; +use ssri::Integrity; +use std::io; +use std::fs; +use std::path::Path; + +pub fn rm(cache: &Path, sri: &Integrity) -> io::Result<()> { + fs::remove_file(path::content_path(&cache, &sri)) +} diff --git a/src/lib.rs b/src/lib.rs index 286585c..deb053e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ mod content; pub use crate::content::path; pub use crate::content::read; +pub use crate::content::rm; pub use crate::content::write;