Documentation
¶
Overview ¶
Package contextio provides io decorators that are context-aware.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCloser ¶
NewCloser wraps an io.Reader to handle context cancellation.
The underlying io.Closer is closed even if the context is done.
func NewReader ¶
NewReader wraps an io.Reader to handle context cancellation.
Context state is checked BEFORE every Read.
If r implements io.ReadCloser, the returned reader will also implement io.ReadCloser.
func NewWriter ¶
NewWriter wraps an io.Writer to handle context cancellation.
Context state is checked BEFORE every Write.
The returned Writer also implements io.ReaderFrom to allow io.Copy to select the best strategy while still checking the context state before every chunk transfer.
If w implements io.WriteCloser, the returned Writer will also implement io.WriteCloser.
Types ¶
This section is empty.