stdio

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: MIT Imports: 5 Imported by: 0

README

Stdio

stdio provide some standard IO util functions.

Install

go get github.com/gookit/goutil/stdio

Go docs

Usage

Please see tests.

Testings

go test -v ./stdio/...

Test limit by regexp:

go test -v -run ^TestSetByKeys ./stdio/...

Documentation

Overview

Package stdio provide some standard IO util functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscardReader

func DiscardReader(src io.Reader)

DiscardReader anything from the reader

func MustReadReader

func MustReadReader(r io.Reader) []byte

MustReadReader read contents from io.Reader, will panic on error

func NewIOReader added in v0.6.2

func NewIOReader(in any) io.Reader

NewIOReader instance by input: string, bytes, io.Reader

func NewScanner added in v0.6.2

func NewScanner(in any) *bufio.Scanner

NewScanner instance by input data or reader

func QuietFprint added in v0.5.6

func QuietFprint(w io.Writer, ss ...string)

QuietFprint to writer, will ignore error

func QuietFprintf added in v0.5.6

func QuietFprintf(w io.Writer, tpl string, vs ...any)

QuietFprintf to writer, will ignore error

func QuietFprintln added in v0.5.6

func QuietFprintln(w io.Writer, ss ...string)

QuietFprintln to writer, will ignore error

func QuietWriteString

func QuietWriteString(w io.Writer, ss ...string)

QuietWriteString to writer, will ignore error

func ReadString added in v0.6.2

func ReadString(r io.Reader) string

ReadString read contents from io.Reader

Types

type WriteWrapper

type WriteWrapper struct {
	Out io.Writer
}

WriteWrapper warp io.Writer support more operate methods.

func NewWriteWrapper

func NewWriteWrapper(w io.Writer) *WriteWrapper

NewWriteWrapper instance

func (*WriteWrapper) String

func (w *WriteWrapper) String() string

String get write data string

func (*WriteWrapper) Write

func (w *WriteWrapper) Write(p []byte) (n int, err error)

Write bytes data

func (*WriteWrapper) WriteByte

func (w *WriteWrapper) WriteByte(c byte) error

WriteByte data

func (*WriteWrapper) WriteString

func (w *WriteWrapper) WriteString(s string) (n int, err error)

WriteString data

func (*WriteWrapper) Writef added in v0.5.14

func (w *WriteWrapper) Writef(tpl string, vs ...any) (n int, err error)

Writef data to output

Jump to

Keyboard shortcuts

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