component_store/fs.rs
1use std::path::{Path, PathBuf};
2
3use crate::StoreError;
4
5pub fn list(root: &Path) -> Result<Vec<PathBuf>, StoreError> {
6 let mut entries = Vec::new();
7 for entry in std::fs::read_dir(root)? {
8 let entry = entry?;
9 let path = entry.path();
10 if path.is_file() {
11 entries.push(path);
12 }
13 }
14 entries.sort();
15 Ok(entries)
16}
17
18pub fn fetch(path: &Path) -> Result<Vec<u8>, StoreError> {
19 Ok(std::fs::read(path)?)
20}