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 that returns an io.EOF error. If io.EOF is never returned, f is never called and if io.EOF is returned multiple times, f will be called multiple times. If f is called, its return value is returned from the call to r.Read.
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.