summaryrefslogtreecommitdiff
path: root/src/fs.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs.rs')
-rw-r--r--src/fs.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/fs.rs b/src/fs.rs
index 0aaf2a93d..9191d5373 100644
--- a/src/fs.rs
+++ b/src/fs.rs
@@ -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");