fileutils

package
v0.1.2-0...-99e1973 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteFile

func DeleteFile(p string) error

func Exists

func Exists(p string) bool

Exists returns whether or not the given file exists

func FindLine

func FindLine(p, startsWith string) string

FindLine searches the given file for a line that begins with the given string.

func IsEmpty

func IsEmpty(d string) (bool, error)

IsEmpty returns whether or not the given directory is empty

func ReadData

func ReadData(p string) *[]string

ReadData returns file data as an array of lines from the file.

func RemoveLine

func RemoveLine(p, startsWith string)

RemoveLine searches for the line that starts with the given value and, if found, removes it and saves the updated file.

func TempFile

func TempFile(dir, prefix, ext string) (f *os.File, err error)

TempFile creates a new temporary file in the directory dir with a name beginning with prefix and ending with ext, opens the file for reading and writing, and returns the resulting *os.File. If dir is the empty string, TempFile uses the default directory for temporary files (see os.TempDir). Multiple programs calling TempFile simultaneously will not choose the same file. The caller can use f.Name() to find the pathname of the file. It is the caller's responsibility to remove the file when no longer needed.

func WriteData

func WriteData(path string, data []byte)

WriteData writes data to the given path, creating the file if necessary.

Types

This section is empty.

Jump to

Keyboard shortcuts

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