Documentation ¶
Overview ¶
Package reader contains small, reusable APIs that build on the io.Reader interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func After ¶
After returns an io.Reader that proxies to another Reader and calls f after each Read. The return value of f is returned from the call to r.Read instead of the original return value.
func Before ¶
Before returns an io.Reader that proxies calls to Read and executes the given function exactly once before the first call. If the function errors, the error is returned and the call to Read is never proxied to the inner io.Reader (subsequent calls to Read will still be proxied). Because no call to Read returns until the one call to f returns, if f causes Read to be called, it will deadlock. If f panics, future calls of Read return without calling f. For more information see the documentation for sync.Once.