ioext

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultiWriter

type MultiWriter struct {
	// contains filtered or unexported fields
}

MultiWriter is a writer that writes to multiple other writers.

func New

func New(writers ...io.Writer) *MultiWriter

New creates a writer that duplicates its writes to all the provided writers, similar to the Unix tee(1) command. Writers can be added and removed dynamically after creation.

Each write is written to each listed writer, one at a time. If a listed writer returns an error, that overall write operation stops and returns the error; it does not continue down the list.

func (*MultiWriter) Add

func (mw *MultiWriter) Add(w ...io.Writer)

Add appends a writer to the list of writers this multiwriter writes to.

func (*MultiWriter) Len

func (mw *MultiWriter) Len() int

func (*MultiWriter) Remove

func (mw *MultiWriter) Remove(w io.Writer)

Remove will remove a previously added writer from the list of writers.

func (*MultiWriter) Unpack

func (mw *MultiWriter) Unpack() []io.Writer

func (*MultiWriter) Write

func (mw *MultiWriter) Write(p []byte) (n int, err error)

Write writes some bytes to all the writers.

Jump to

Keyboard shortcuts

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