MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / read_file

Method read_file

atomic-core/src/output/filesystem/walk.rs:112–117  ·  view source on GitHub ↗

Read the contents of a file into a buffer. The buffer is **appended to**, not cleared.

(&self, path: &str, buffer: &mut Vec<u8>)

Source from the content-addressed store, hash-verified

110 ///
111 /// The buffer is **appended to**, not cleared.
112 fn read_file(&self, path: &str, buffer: &mut Vec<u8>) -> Result<(), Self::Error> {
113 let abs_path = self.resolve_path(path)?;
114 let mut file = File::open(&abs_path)?;
115 file.read_to_end(buffer)?;
116 Ok(())
117 }
118
119 /// Get the modification time of a file.
120 fn modified_time(&self, path: &str) -> Result<SystemTime, Self::Error> {

Callers 9

test_read_file_simpleFunction · 0.45
test_read_file_binaryFunction · 0.45
test_read_file_nestedFunction · 0.45
test_read_file_not_foundFunction · 0.45
test_read_file_emptyFunction · 0.45
test_full_workflowFunction · 0.45

Calls 1

resolve_pathMethod · 0.45

Tested by 9

test_read_file_simpleFunction · 0.36
test_read_file_binaryFunction · 0.36
test_read_file_nestedFunction · 0.36
test_read_file_not_foundFunction · 0.36
test_read_file_emptyFunction · 0.36
test_full_workflowFunction · 0.36