There are many ways to read a file with the help of Reader and store data into a buffer/slice i.e, []u8 and each require some how to define the max size.
Fixed Buffer (inherently needs size):
One way directly create an empty array and send it as a slice for filling it (Here we need to define the size of array) fn read(self: Self, buffer: []u8)
Array List and max_append_size:
The other way is to initialize Arraylist but still the method needs to know the max size fn readAllArrayList( self: Self, array_list: *std.ArrayList(u8), max_append_size: usize)
Allocator and max_append_size:
The other way is to send an allocator that will create an arraylist behind and store the data fn readAllAlloc(self: Self, allocator: Allocator, max_size: usize,)
Delimiter :
This method: fn streamUntilDelimiter(self: Self, writer: anytype, delimiter: u8, optional_max_size: ?usize,)seems to be promising but needs delimiter, that doesn't make sense for a file.