--chain option for setting which network to go on.

Add contents function to util.
This commit is contained in:
Gav Wood
2016-02-09 15:51:48 +01:00
parent 5938b65097
commit e987a492dc
3 changed files with 42 additions and 6 deletions

View File

@@ -16,6 +16,7 @@
//! Diff misc.
use std::fs::File;
use common::*;
#[derive(Debug,Clone,PartialEq,Eq)]
@@ -53,3 +54,11 @@ pub enum Filth {
/// Data has been changed.
Dirty,
}
/// Read the whole contents of a file `name`.
pub fn contents(name: &str) -> Result<Bytes, UtilError> {
let mut file = try!(File::open(name));
let mut ret: Vec<u8> = Vec::new();
try!(file.read_to_end(&mut ret));
Ok(ret)
}