Skip to main content

ReadAll

Reads all bytes from an io.Reader and stops a provided Timer.

def ReadAll(
r: io.Reader,
t: Timer
) - > []byte, error

Reads all bytes from the provided io.Reader until EOF and stops the associated timer. This function is useful for consuming the entire content of a reader and measuring the duration of the read operation.

Parameters

NameTypeDescription
rio.ReaderThe source from which to read all bytes until EOF.
tTimerThe timer to stop once the read operation is complete, used for measuring the duration of the read.

Returns

TypeDescription
[]byte, errorThe content read from the reader as a byte slice, and an error if the read operation fails.