filex

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2020 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 IsDirectory

func IsDirectory(path string) (bool, error)

Return true if path is exists and is directory

func IsFile

func IsFile(path string) (bool, error)

Return true if path is exists and is regular file

func ReadAllBytes added in v1.1.1

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

Read and return all data in file

func ReadAllLines

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

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

func ReadAllLinesWithEncoding

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

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

func ReadAllToString

func ReadAllToString(path string) (string, error)

Read and return all data as string in file

func ReadAllToStringWithEncoding

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

Read and return all data as string in file

func ReadAllToWriter added in v1.1.1

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

Read all data from file, into a writer

func ReadLines

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

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

func ReadLinesWithEncoding

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

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

func WriteAllFromReader added in v1.1.1

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

Write all data from a reader, to a file.

func WriteBytes added in v1.1.1

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

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

func WriteString

func WriteString(path string, str string) error

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

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