Documentation
¶
Index ¶
- func ChainedCloser(this io.ReadCloser, other io.Closer) io.ReadCloser
- func NewCleanupReadCloser(r io.ReadCloser, cleanup func() error) io.ReadCloser
- func NewCountingReader(rc io.ReadCloser, bytesRead *atomic.Uint64) io.ReadCloser
- func WriterToReader(reader io.Reader, writerSource func(writer io.Writer) io.WriteCloser) io.Reader
- type CleanupReadCloser
- type CloserFunc
- type CountingReader
- type LatencyReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChainedCloser ¶
func ChainedCloser(this io.ReadCloser, other io.Closer) io.ReadCloser
func NewCleanupReadCloser ¶ added in v0.8.6
func NewCleanupReadCloser(r io.ReadCloser, cleanup func() error) io.ReadCloser
NewCleanupReadCloser creates an io.ReadCloser that calls the cleanup function after closing the original closer. This is useful for cleaning up temporary files.
func NewCountingReader ¶ added in v0.18.0
func NewCountingReader(rc io.ReadCloser, bytesRead *atomic.Uint64) io.ReadCloser
NewCountingReader creates a wrapper around io.ReadCloser that tracks the total bytes read using an atomic counter.
func WriterToReader ¶
WriterToReader transforms an io.Writer that is provided by the given function into an io.Reader.
Types ¶
type CleanupReadCloser ¶ added in v0.8.6
type CleanupReadCloser struct {
// contains filtered or unexported fields
}
CleanupReadCloser wraps an io.ReadCloser and a function to be called on Close.
func (*CleanupReadCloser) Close ¶ added in v0.8.6
func (f *CleanupReadCloser) Close() error
Close closes the reader and calls the provided function.
type CloserFunc ¶
type CloserFunc func() error
CloserFunc is the basic Close method defined in io.Closer.
func (CloserFunc) Close ¶
func (fn CloserFunc) Close() error
Close performs close operation by the CloserFunc.
type CountingReader ¶ added in v0.18.0
type CountingReader struct {
// contains filtered or unexported fields
}
CountingReader is a wrapper around io.ReadCloser that tracks the total number of bytes read using an atomic counter.
func (*CountingReader) Close ¶ added in v0.18.0
func (c *CountingReader) Close() error