MCPcopy Create free account
hub / github.com/BitVM/BitVM / read_file

Function read_file

bridge/src/client/files.rs:56–68  ·  view source on GitHub ↗
(path: &Path)

Source from the content-addressed store, hash-verified

54}
55
56fn read_file(path: &Path) -> Option<String> {
57 match fs::read_to_string(path) {
58 Ok(content) => Some(content),
59 Err(e) => match e.kind() {
60 std::io::ErrorKind::NotFound => return None,
61 _ => {
62 // If the file exists, but we cannot read it (e.g. due to invalid permissions, etc.),
63 // we want to fail and let the user fix the issue.
64 panic!("Could not read file {} due to error: {}", path.display(), e);
65 }
66 },
67 }
68}
69
70pub fn save_local_public_file(data_root_path: &Path, file_name: &String, contents: &String) {
71 create_directories_if_non_existent(data_root_path);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected