This commit is contained in:
theubusu
2025-09-11 20:26:51 +02:00
commit 838e0271ce
7 changed files with 392 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
use std::fs::{File};
use std::io::{Read, Seek, SeekFrom};
pub fn read_file(mut file: &File, offset: u64, size: usize) -> Result<Vec<u8>, Box<dyn std::error::Error>> {
file.seek(SeekFrom::Start(offset))?;
let mut buffer = vec![0u8; size];
let _bytes_read = file.read(&mut buffer)?;
Ok(buffer)
}