#offset #atomically #file #reading #reading-file #read #write

file_offset

Atomically read and write files at given offsets

2 releases

Uses old Rust 2015

0.1.1 Jul 15, 2017
0.1.0 Jul 13, 2017

#10 in #reading-file

Download history 3/week @ 2024-11-13 13/week @ 2024-11-20 15/week @ 2024-11-27 13/week @ 2024-12-04 31/week @ 2024-12-11 14/week @ 2024-12-18 5/week @ 2024-12-25 6/week @ 2025-01-15 9/week @ 2025-01-22 28/week @ 2025-01-29 15/week @ 2025-02-05 15/week @ 2025-02-12 7/week @ 2025-02-19 12/week @ 2025-02-26

59 downloads per month
Used in 3 crates (via pre-rfc3243-libtw2-common)

MIT/Apache

7KB

file_offset provides a platform-independent way of atomically reading and writing files at specified offsets.

use file_offset::FileExt;
use std::fs::File;
use std::str;

let mut buffer = [0; 2048];
let f = File::open("src/lib.rs").unwrap();
f.read_offset(&mut buffer, 3);
print!("{}", str::from_utf8(&buffer).unwrap());

No runtime deps