fs

package
v0.33.2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendToFile

func AppendToFile(s string, filename string) error

AppendToFile write s to the end of filename

func EnsureDir

func EnsureDir(dir string) error

EnsureDir creates directory if it doesnt exist

func FileExist

func FileExist(path string) bool

FileExist check if path exist

func GetDir

func GetDir(devEnv bool) (string, error)

GetDir returns the program root directory

func OverwriteFile

func OverwriteFile(s string, filename string) error

OverwriteFile truncate filename and write s into it

func OverwriteFileBytes added in v0.32.1

func OverwriteFileBytes(b []byte, filename string) error

OverwriteFileBytes truncate filename and write b []bytes into it

func OverwriteFileValueIndent added in v0.32.1

func OverwriteFileValueIndent(v interface{}, filename string) error

OverwriteFileValueIndent marshall v into indented json, then truncate the file filename and write the marshalled bytes into it

func Write added in v0.32.1

func Write(s string, w io.StringWriter) error

func WriteBytes added in v0.32.1

func WriteBytes(b []byte, w io.Writer) error

Types

type FileWriter added in v0.26.2

type FileWriter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

FileWriter allows concurrent writes to a file

func (*FileWriter) EnqueueWrite added in v0.26.2

func (fw *FileWriter) EnqueueWrite(data string) (err error)

EnqueueWrite writes string to the target file

func (*FileWriter) Init added in v0.26.2

func (fw *FileWriter) Init(filePath string, queueLength int) (err error)

Init setup the FileWriter

func (*FileWriter) Stop added in v0.26.2

func (fw *FileWriter) Stop() (err error)

Stop ends the file writer

Jump to

Keyboard shortcuts

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