io

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: GPL-2.0, GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package io contains custom functions extending the native `io` package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DuplicateReader

func DuplicateReader(reader systemio.Reader, errorCallback func(error)) (systemio.Reader, systemio.Reader)

DuplicateReader copies reads from a single io.Reader into a pair of io.Readers

It is the io.Reader analogue of an io.MultiWriter

func NewContinuousReader

func NewContinuousReader(reader systemio.Reader) systemio.Reader

NewContinuousReader creates a new ContinuousReader by wrapping an existing io.Reader

Types

type BellSkipper

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

BellSkipper is a custom WriteCloser that skips `Bell` characters

Used to prevent promptui making sounds when a button is pressed

func NewBellSkipper

func NewBellSkipper(baseOutput systemio.WriteCloser) *BellSkipper

NewBellSkipper creates a new BellSkipper WriteCloser

func (*BellSkipper) Close

func (skipper *BellSkipper) Close() error

Close closes the data stream

func (*BellSkipper) Write

func (skipper *BellSkipper) Write(b []byte) (int, error)

Write writes len(p) bytes from p to the underlying data stream.

type ContinuousReader

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

ContinuousReader is an io.Reader that wraps another reader and ignores io.EOF markers

This can be useful if you want to continue reading from a buffered reader after the buffer has been exhausted, for example

func (ContinuousReader) Read

func (reader ContinuousReader) Read(p []byte) (int, error)

NewContinuousReader creates a new ContinuousReader by wrapping an existing io.Reader

Read reads up to len(p) bytes into p. If an io.EOF error is returned by the underlying reader, it is silently ignored.

type ErrorReader added in v0.32.28

type ErrorReader struct {
}

func NewErrorReader added in v0.32.28

func NewErrorReader() *ErrorReader

func (*ErrorReader) Read added in v0.32.28

func (errorWriter *ErrorReader) Read(p []byte) (int, error)

Jump to

Keyboard shortcuts

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