Documentation
¶
Overview ¶
Package ctxio makes a long copy stop with its context.
io.Copy runs to the end of its source whatever happens around it, and a source of many GiB on a slow disk takes minutes. Read through Reader, the copy ends at the next read after a stop.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Reader ¶
Reader reads from r for as long as ctx lasts. Once ctx is done, Read returns ctx.Err() and reads nothing, so a copy from it fails with that error at its next read.
The context is asked before every read. A copy reads 32 KiB or more at a time, so the check costs nothing a reader of files would notice.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.