io

package module
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 17 Imported by: 5

README

io

Provides reader and writer IO methods and abilities

##ioreader

  • iocsv
  • ioexif
  • ioimage
  • passthrough (provides ability to display progress or a counter of data)

iowriter

logstash

cat

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendKeyValue

func AppendKeyValue(b *bytes.Buffer, key string, value interface{}, quoteEmptyField bool)

func AppendValue

func AppendValue(b *bytes.Buffer, value interface{}, quoteEmptyField bool)

func AsBytes

func AsBytes() ([]byte, error)

AsBytes read file into []byte

func AsCSVIntoMap

func AsCSVIntoMap() *map[string]string

AsCSVIntoMap read csv file into map[string]string

func AsString

func AsString() (string, error)

AsString read file as a string

func Bytes

func Bytes(buf []byte)

Bytes read file into passed byte array

func CheckIfTerminal

func CheckIfTerminal(w io.Writer) bool

func LastLineWithSeek

func LastLineWithSeek(filepath string, amt int) ([]string, error)

func LineScanner

func LineScanner(maxBuf, maxScanTokenSize int) (string, error)

func NeedsQuoting

func NeedsQuoting(text string, quoteEmptyField bool) bool

func Open

func Open(uri string) (io.ReadCloser, error)

Open returns an io.ReadCloser representing the contents of the source specified by a uri.

func ReadLine

func ReadLine(br *bufio.Reader) (string, error)

ReadLine Line returns a single line (without the ending \n) from the input buffered reader. An error is returned if` there is an error with the buffered reader.

func WriteOut

func WriteOut(data []byte, filePath string) (int, error)

WriteOut write out []byte data to designated file path

func WriteOutAppend

func WriteOutAppend(data []byte, filePath string)

WriteOutAppend write out and append []byte data to designated file path

func WriteOutStr

func WriteOutStr(data, filePath string) (int, error)

WriteOutStr write out string data to designated file path

func WriteOutString

func WriteOutString(filePath string) *os.File

WriteOutString send file to create and returns File object to use

func WriteTempFileOfSize

func WriteTempFileOfSize(filesize int64, fileprefix string) (fileName string, fileSize int64)

Types

type Reader

type Reader interface {
	Bytes(buf []byte)
	AsBytes() ([]byte, error)
	AsString() (string, error)
	LineScanner(maxBuf, maxScanTokenSize int) (string, error)
	AsCSVIntoMap() *map[string]string
	AsCSVIntoOrderedMap() (*orderedmap.OrderedMap, error)
	ReadCSVFromFile(filePath string, skipHeader bool, headAr []string) (*data.Table, error)
}

type Writer

type Writer interface {
	WriteOut(data []byte, filePath string)
	WriteOutStr(data, filePath string)
	WriteOutString(filePath string) *os.File
	WriteTempFileOfSize(filesize int64, fileprefix string) (fileName string, fileSize int64)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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