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

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 #atomically

Download history 3/week @ 2023-12-04 13/week @ 2023-12-11 1/week @ 2023-12-18 24/week @ 2023-12-25 36/week @ 2024-01-01 2/week @ 2024-01-15 57/week @ 2024-02-19 17/week @ 2024-02-26 8/week @ 2024-03-04

82 downloads per month

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