filex

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2021 License: BSD-2-Clause Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(path string) (bool, error)

Exists check if file exists

func ForEachLine added in v1.2.0

func ForEachLine(path string, consume func(line string)) error

ForEachLine read line by line from a file, and return a error if read failed.

func ForEachLineWithEncoding added in v1.2.0

func ForEachLineWithEncoding(path string, enc encoding.Encoding, consume func(line string)) error

ForEachLineWithEncoding read line by line from a file with specific, and return a error if read failed.

func IsDirectory

func IsDirectory(path string) (bool, error)

IsDirectory return true if path is exists and is directory

func IsFile

func IsFile(path string) (bool, error)

IsFile return true if path is exists and is regular file

func ReadAllBytes added in v1.1.1

func ReadAllBytes(path string) ([]byte, error)

ReadAllBytes read and return all data in file

func ReadAllLines

func ReadAllLines(path string) ([]string, error)

ReadAllLines read all data from a file till EOF, return a lines slice.

func ReadAllLinesWithEncoding

func ReadAllLinesWithEncoding(path string, enc encoding.Encoding) ([]string, error)

ReadAllLinesWithEncoding read all data from a file till EOF, return a lines slice.

func ReadAllToString

func ReadAllToString(path string) (string, error)

ReadAllToString read and return all data as string in file

func ReadAllToStringWithEncoding

func ReadAllToStringWithEncoding(path string, enc encoding.Encoding) (string, error)

ReadAllToStringWithEncoding read and return all data as string in file

func ReadAllToWriter added in v1.1.1

func ReadAllToWriter(path string, w io.Writer) error

ReadAllToWriter read all data from file, into a writer

func WriteAllFromReader added in v1.1.1

func WriteAllFromReader(path string, r io.Reader) error

WriteAllFromReader write all data from a reader, to a file.

func WriteBytes added in v1.1.1

func WriteBytes(path string, data []byte) error

WriteBytes write all data to file, and then close. If file already exists, will be override

func WriteString

func WriteString(path string, str string) error

WriteString write all string content to file, and then close. If file already exists, will be override

func WriteStringWithEncoding

func WriteStringWithEncoding(path string, str string, enc encoding.Encoding) error

WriteStringWithEncoding write all string content to file using specific encoding, and then close. If file already exists, will be override

Types

This section is empty.

Jump to

Keyboard shortcuts

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