#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

#13 in #reading-file

43 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