package ioutils

import "github.com/dotcloud/docker/internal/ioutils"

Index

Functions

func CopyCtx

func CopyCtx(ctx context.Context, dst io.Writer, src io.Reader) (n int64, err error)

CopyCtx copies from src to dst until either EOF is reached on src or a context is cancelled. The writer is not closed when the context is cancelled.

After CopyCtx exits due to context cancellation, the goroutine that performed the copy may still be running if either the reader or writer blocks.

func NewCtxReader

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

NewCtxReader wraps the given reader with a reader that doesn't proceed with reading if the context is done.

Note: Read will still block if the underlying reader blocks.

Source Files

copy.go

Version
v28.1.1+incompatible (latest)
Published
Apr 18, 2025
Platform
linux/amd64
Imports
2 packages
Last checked
53 minutes ago

Tools for package owners.