Read all of file contents using a preallocated buffer. The returned slice has the same pointer as buffer
. If the length matches buffer.len
the situation is ambiguous. It could either mean that the entire file was read, and it exactly fits the buffer, or it could mean the buffer was not big enough for the entire file.