contextio

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReader

func NewReader(ctx context.Context, r io.Reader) io.Reader

NewReader wraps an io.Reader to handle context cancellation.

Context state is checked BEFORE every Read.

func NewResponseWriter

func NewResponseWriter(ctx context.Context, w http.ResponseWriter) http.ResponseWriter

NewResponseWriter wraps an http.ResponseWriter to handle context cancellation.

Context state is checked BEFORE every Write.

The returned ResponseWriter also implements io.ReaderFrom to allow io.Copy to select the best strategy while still checking the context state before every chunk transfer.

func NewWriter

func NewWriter(ctx context.Context, w io.Writer) io.Writer

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL