Module readutil

Module readutil 

Source
Expand description

File reading utilities for forward and tail (reverse) reading. Port of Go’s pkg/util/readutil/readutil.go.

Provides line-based file reading with support for line counts, byte limits, line skipping, and progressive tail reading.

Constants§

STOP_REASON_BOF
Stop reason: beginning of file reached.
STOP_REASON_EOF
Stop reason: end of file reached.
STOP_REASON_READ_LIMIT
Stop reason: byte read limit reached.

Functions§

read_last_n_line_offsets
Find the byte offsets of the last N lines in a seekable reader.
read_lines
Read lines forward from a reader.
read_tail_lines
Read the last line_count lines from a seekable reader with a byte limit.
read_tail_lines_internal 🔒
Read the last line_count lines from a seekable reader, optionally skipping the last line_offset lines.