mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-14 17:05:06 -05:00
chore: add fs read (#5706)
This commit is contained in:
@@ -108,6 +108,14 @@ pub fn read_to_string(path: impl AsRef<Path>) -> Result<String> {
|
||||
fs::read_to_string(path).map_err(|err| FsPathError::read(err, path))
|
||||
}
|
||||
|
||||
/// Read the entire contents of a file into a bytes vector.
|
||||
///
|
||||
/// Wrapper for `std::fs::read`
|
||||
pub fn read(path: impl AsRef<Path>) -> Result<Vec<u8>> {
|
||||
let path = path.as_ref();
|
||||
fs::read(path).map_err(|err| FsPathError::read(err, path))
|
||||
}
|
||||
|
||||
/// Wrapper for `std::fs::write`
|
||||
pub fn write(path: impl AsRef<Path>, contents: impl AsRef<[u8]>) -> Result<()> {
|
||||
let path = path.as_ref();
|
||||
|
||||
Reference in New Issue
Block a user