Keyboard shortcuts

Press ← or β†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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(), or segments() 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, and limit parameters
  • πŸ’» 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