fs

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileAppender

type FileAppender interface {
	FileWriter
}

FileAppender is FileWriter with append behavior

type FileReader

type FileReader interface {
	Err() error
	Info() os.FileInfo
	String() string
	Lines() []string
	Bytes() []byte
	Into(io.Writer) FileReader
}

FileReader aggregates read operations from diverse sources into a file

func Read

func Read(path string) FileReader

Read creates a FileReader using the provided path. A non-nil FileReader.Err() is returned if file does not exist or another error is generated.

type FileWriter

type FileWriter interface {
	Err() error
	Info() os.FileInfo
	String(string) FileWriter
	Lines([]string) FileWriter
	Bytes([]byte) FileWriter
	From(io.Reader) FileWriter
}

FileWriter aggregates several file-writing operations from diverse sources into a provided file.

func Append

func Append(path string) FileWriter

Append creates a new file, or append to an existing one, using the path provided and sets it up for write operation only. Any error generated is returned by FileWriter.Err().

func Write

func Write(path string) FileWriter

Write creates a new file,or truncates an existing one, using the path provided and sets it up for write operations. Operation error is returned by FileWriter.Err().

Jump to

Keyboard shortcuts

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