diff --git a/src/tools.rs b/src/tools.rs index ca64f64c..5d842377 100644 --- a/src/tools.rs +++ b/src/tools.rs @@ -77,6 +77,17 @@ pub fn file_read_firstline>(path: P) -> Result>(path: P) -> Result, std::io::Error> { + + let mut file = std::fs::File::open(path)?; + + let mut buffer = Vec::new(); + + file.read_to_end(&mut buffer)?; + + Ok(buffer) +} + /// Atomically write a file. We first create a temporary file, which /// is then renamed. pub fn file_set_contents>(