diff options
Diffstat (limited to 'src/fs.rs')
-rw-r--r-- | src/fs.rs | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1,6 +1,7 @@ use std; use std::fs::File; use std::io::Read; +use std::io::Write; use std::path::Path; pub fn read_file_sync(path: &Path) -> std::io::Result<Vec<u8>> { @@ -17,6 +18,11 @@ pub fn read_file_sync_string(path: &Path) -> std::io::Result<String> { .map_err(|err| std::io::Error::new(std::io::ErrorKind::InvalidData, err)) } +pub fn write_file_sync(path: &Path, content: &[u8]) -> std::io::Result<()> { + let mut f = File::create(path)?; + f.write_all(content) +} + pub fn mkdir(path: &Path) -> std::io::Result<()> { debug!("mkdir -p {}", path.display()); assert!(path.has_root(), "non-has_root not yet implemented"); |