fn readToEndAllocOptions(self: File, allocator: mem.Allocator, max_bytes: usize, size_hint: ?usize, comptime alignment: u29, comptime optional_sentinel: ?u8) !if (optional_sentinel) |s| [:s]align(alignment) u8 else []align(alignment) u8
[src]
Reads all the bytes from the current position to the end of the file. On success, caller owns returned buffer. If the file is larger than max_bytes
, returns error.FileTooBig
. If size_hint
is specified the initial buffer size is calculated using that value, otherwise an arbitrary value is used instead. Allows specifying alignment and a sentinel value.