From eac29d941b0e36c143d3262e891fdbf991e316d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Fri, 24 May 2019 17:14:06 -0700 Subject: [PATCH] feat(rm): added content/rm --- src/content/mod.rs | 1 + src/content/rm.rs | 9 +++++++++ src/lib.rs | 1 + 3 files changed, 11 insertions(+) create mode 100644 src/content/rm.rs 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;