baml.io.Read
A common interface for reading bytes from a source.
Signature
interface baml.io.ReadA common interface for reading bytes from a source.
Implementors are expected to provide a read method that attempts to read up to limit bytes from the source.
Based on Rust's Read trait
and JavaScript's ReadableStream.
Source:<builtin>/baml/ns_io/read.bamlbytes 371–1594
Required instance methods
Read up to limit bytes from the source.
Returns null after EOF. A non-null result is empty only when limit
is non-positive: null is reserved for end of input, so a caller that
asks for no bytes gets an empty read back rather than an EOF signal.
Every implementor agrees on this — driving a loop off read therefore
requires a positive limit, as bytes and text below use.
Default instance methods
Consume all remaining bytes through EOF.
Consume all remaining bytes through EOF and decode strict UTF-8.