stream: STREAM_TYPE_FILE will now read file upfront

No more having to chunk read - if ~stream_init_file~ is used, the
constructor slurps the entire file into the cache.  This pays up front
for a bunch of checks essentially.

~stream_init_pipe~ should be used for chunked reading.
This commit is contained in:
2026-02-09 08:10:44 +00:00
committed by oreodave
parent 6a54c54bfb
commit f56a59ff7a
3 changed files with 24 additions and 16 deletions

View File

@@ -53,6 +53,8 @@ typedef struct
stream_err_t stream_init_string(stream_t *, const char *, sv_t);
stream_err_t stream_init_pipe(stream_t *, const char *, FILE *);
// NOTE: stream_init_file will attempt to read all content from the FILE
// descriptor. Use with caution.
stream_err_t stream_init_file(stream_t *, const char *, FILE *);
void stream_stop(stream_t *);