feat(content): add baseline read functionality

This commit is contained in:
Kat Marchán 2019-05-20 18:11:58 -07:00
parent 0f768fa5c0
commit e98bfb17da
No known key found for this signature in database
GPG Key ID: AEB529C08A3C7E9E
3 changed files with 14 additions and 0 deletions

View File

@ -1 +1,2 @@
pub mod path;
pub mod read;

12
src/content/read.rs Normal file
View File

@ -0,0 +1,12 @@
use crate::content::path::content_path;
use ssri::Integrity;
use std::path::Path;
use std::fs::File;
pub fn open(cache: &Path, sri: &Integrity) -> std::io::Result<File> {
File::open(content_path(&cache, &sri))
}
pub fn copy(cache: &Path, sri: &Integrity, to: &Path) -> std::io::Result<u64> {
std::fs::copy(content_path(&cache, &sri), to)
}

View File

@ -1,2 +1,3 @@
mod content;
pub use crate::content::path;
pub use crate::content::read;