tvix/eval: EvalIO should allow reading a file in a more granular fashion
builtins.hashFile algo ./path/to/file
returns a hex-encoded digest of the file.
We currrently can only use read_to_string
, which reads the entire contents into memory.
We should extend this with an additional method that gives you an impl std::io::Read
, so we don't have to read everything into memory.
We can provide a default implementation that does just use read_to_string() internally, and returns a Cursor over it, but implementations that can do better (like StdIO and TvixStoreIO) should probably do.
- flokli changed the subject of this issue from "tvix/eval: EvalIO should have allow reading a file in a more granular fashion" to "tvix/eval: EvalIO should allow reading a file in a more granular fashion" at 2024-02-21T13·49+00
Took a pass at this in cl/11236. Ended up replacing
read_to_string
withopen_file
, then the callers can decide if they want to buffer into a string.cbrewster at 2024-03-23T00·09+00
I think this is sufficient for now. There's nothing inside nixlang requiring seeking.
flokli at 2024-04-21T15·07+00
- flokli closed this issue at 2024-04-21T15·07+00