Get the raw contents of a file. Returns `None` if the file doesn't exist or is a directory. # Example ```rust use atomic_core::output::Memory; let wc = Memory::new(); wc.add_file("test.txt", b"hello"); let contents = wc.get_file_contents("test.txt").unwrap(); assert_eq!(contents, b"hello"); ```
(&self, path: &str)
| 375 | /// assert_eq!(contents, b"hello"); |
| 376 | /// ``` |
| 377 | pub fn get_file_contents(&self, path: &str) -> Option<Vec<u8>> { |
| 378 | let files = self.files.borrow(); |
| 379 | files.get(path).and_then(|f| { |
| 380 | if f.metadata.is_dir { |
| 381 | None |
| 382 | } else { |
| 383 | Some(f.contents.clone()) |
| 384 | } |
| 385 | }) |
| 386 | } |
| 387 | |
| 388 | /// Get the inode for a file. |
| 389 | /// |