pub async fn read_until_filled(
stream: impl AsyncRead + Unpin,
buffer: &mut [u8],
) -> Result<usize>
Expand description
smol::fs::File::read does not guarantee that the buffer will be filled, even if the buffer is smaller than the file. This is a workaround. This reads the stream until the buffer is full or until we reached the end of the stream.