splitter

package
v2.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClosedWriter = errors.New("Writing to closed writer prohibited")

Functions

This section is empty.

Types

type Splitter

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

Splitter is a thread-safe writer to split multi-line output at newlines and carriage-returns. For example to split program output having progress lines in it like ffmpeg does.

func New

func New() *Splitter

New creates a new splitter instance and starts the analyzer routeing inside

func (*Splitter) Close

func (c *Splitter) Close() error

Close disables the analyzer and prevents further write to the splitter

func (Splitter) Subscribe

func (c Splitter) Subscribe() <-chan []byte

Subscribe returns a channel containing the output lines

func (*Splitter) Write

func (c *Splitter) Write(p []byte) (n int, err error)

Write is a standard implementation of io.Writer returning ErrClosedWriter on a write after it got closed

Jump to

Keyboard shortcuts

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