adk_bounded_file (erlang_adk v0.10.0)
View SourceAllocation-bounded reader for untrusted regular files.
The metadata check rejects known-oversized and non-regular inputs before opening them. The read itself remains capped at MaxBytes + 1 so a file replaced or grown after that check cannot force an unbounded allocation.
Summary
Functions
-spec read(file:filename_all(), non_neg_integer()) -> {ok, binary()} | {error, file_too_large | {invalid_file_type, atom()} | {file_read_failed, term()}}.