Introduction
preader is a file reader that tracks read progress and manages read state. You can read a file in chunks, lines, bytes, or delimited segments, save your position at any point, and resume later from exactly where you left off, even after a restart
The library is available as a Rust crate and as a Python package (via PyO3 bindings). Both APIs expose the same features with the same semantics
Features
- π οΈ Multiple Iterators: Read files using
lines(),bytes(),chunks(), orsegments()depending on your use case - βΆοΈ Resumable Reads: Persist your read position to disk using
save(), then resume from the same state whenever you want - π Read Percentage: Track how far you have read through the file with the
percent()method - πΎ Autosave: Automatically saves your state at a configurable byte interval so you donβt lose progress if the program crashes
- π State Management: Manage saved states through the registry with
names(),load(),search(),delete(),resync()and more - π State Verification: Checks file size, path, modification time, and fingerprint before resuming to detect changes
- ποΈ Windowing: Control the read range with
start,end,skip, andlimitparameters - π» Cross Platform: Works on Linux, macOS, and Windows with portable state naming rules
Who Is This For?
preader is useful when you process large files and need to:
- Resume after an interruption without starting over
- Track how much of a file you have processed
- Manage read state for multiple files or multiple jobs on the same file
- Detect when a file has changed since you last read it
Common use cases include log processing, data pipelines, ETL jobs, and any batch work over large files
Getting Started
Head to the Quickstart to read your first file and save your position in a few lines of code