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

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

#8 in #reading-file

Download history 14/week @ 2024-07-21 9/week @ 2024-07-28 4/week @ 2024-08-04 6/week @ 2024-08-11 1/week @ 2024-08-18 7/week @ 2024-08-25 1/week @ 2024-09-01 9/week @ 2024-09-15 19/week @ 2024-09-22 3/week @ 2024-09-29 9/week @ 2024-10-06 7/week @ 2024-10-13 13/week @ 2024-10-20 9/week @ 2024-10-27 35/week @ 2024-11-03

65 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