iotools

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadFnCloser

func ReadFnCloser(r io.Reader, close func() error) io.ReadCloser

ReadFnCloser takes an io.Reader and wraps it to use the provided function to implement io.Closer.

func StreamReadFunc

func StreamReadFunc(read func(io.Reader) error) io.Writer

func StreamWriteFunc

func StreamWriteFunc(write func(io.Writer) error) io.Reader

func TempFileSeeker

func TempFileSeeker(r io.Reader) (io.ReadSeekCloser, error)

TempFileSeeker converts the provided Reader into a ReadSeekCloser by using an underlying temporary file. Callers should call the Close function when they're done with the TempFileSeeker, to release + clean up the temporary file.

func WriteFnCloser

func WriteFnCloser(w io.Writer, close func() error) io.WriteCloser

WriteFnCloser takes an io.Writer and wraps it to use the provided function to implement io.Closer.

Types

type SilentReader

type SilentReader struct {
	io.Reader
	// contains filtered or unexported fields
}

SilentReader wraps an io.Reader to silence any error output during reads. Instead they are stored and accessible (not concurrency safe!) via .Error().

func SilenceReader

func SilenceReader(r io.Reader) *SilentReader

SilenceReader wraps an io.Reader within SilentReader{}.

func (*SilentReader) Error

func (r *SilentReader) Error() error

func (*SilentReader) Read

func (r *SilentReader) Read(b []byte) (int, error)

type SilentWriter

type SilentWriter struct {
	io.Writer
	// contains filtered or unexported fields
}

SilentWriter wraps an io.Writer to silence any error output during writes. Instead they are stored and accessible (not concurrency safe!) via .Error().

func SilenceWriter

func SilenceWriter(w io.Writer) *SilentWriter

SilenceWriter wraps an io.Writer within SilentWriter{}.

func (*SilentWriter) Error

func (w *SilentWriter) Error() error

func (*SilentWriter) Write

func (w *SilentWriter) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

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