Byte Range
The start and end options define a byte range within the file. Only items that begin within this range are yielded
start
The byte offset where reading begins. Default: 0
When resuming from a saved state, if start is beyond the saved position, the position moves forward to start. If the saved position is already past start, the saved position wins
end
The byte offset at which no new item starts. For line and segment iterators, an item that begins before end is yielded in full even if it extends past end. For chunk iterators, the last chunk is truncated to fit within the remaining range. Default: u64::MAX (no limit)
Examples
Rust
let lines = reader.lines("data.txt")
.start(100)
.end(500)
.build()?;
for line in lines {
println!("{}", line?);
}
Python
from preader import IteratorOptions
options = IteratorOptions(start=100, end=500)
for line in reader.lines("data.txt", options=options):
print(line)
Setting
startgreater thanendraises anInvalidRangeerror in Rust and aValueErrorin Python