use std::path::Path;
use super::Graph;
use crate::error::Result;
use crate::fs::{DirEntry, Metadata, ReadStorage};
impl<FS: ReadStorage, Ix> Graph<FS, Ix> {
pub async fn exists(&self, path: &Path) -> Result<bool> {
Ok(self.fs().try_exists(&self.root().join(path)).await?)
}
pub async fn read_bytes(&self, path: &Path) -> Result<Vec<u8>> {
Ok(self.fs().read(&self.root().join(path)).await?)
}
pub async fn read_text(&self, path: &Path) -> Result<String> {
Ok(self.fs().read_to_string(&self.root().join(path)).await?)
}
pub async fn listing(&self, path: &Path) -> Result<Vec<DirEntry>> {
Ok(self.fs().read_dir(&self.root().join(path)).await?)
}
pub async fn stat(&self, path: &Path) -> Result<Metadata> {
Ok(self.fs().metadata(&self.root().join(path)).await?)
}
}