ioutilmore

package
v0.37.5 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseFileWithError

func CloseFileWithError(file *os.File, err error) error

func CopyFile

func CopyFile(src, dst string) error

func DirFromPath

func DirFromPath(path string) (string, error)

func FileInfosSplit

func FileInfosSplit(all []os.FileInfo, inclDotDirs bool) ([]os.FileInfo, []os.FileInfo)

func FileinfosNames

func FileinfosNames(fis []os.FileInfo) []string

func FilepathModAgeGTE

func FilepathModAgeGTE(path string, s string) (bool, error)

func FilepathModAgeLTE

func FilepathModAgeLTE(path string, s string) (bool, error)

func FilterFilenamesSizeGtZero

func FilterFilenamesSizeGtZero(filepaths ...string) []string

func GetFileModAge

func GetFileModAge(fi os.FileInfo) (time.Duration, error)

func GetFilepathModAge

func GetFilepathModAge(path string) (time.Duration, error)

func ReadAllOrError

func ReadAllOrError(r io.Reader) []byte

ReadAllOrError will successfully return the data or return the error in the value return value. This is useful to simply test scripts where the data is printed for debugging or testing.

func ReadDirSplit

func ReadDirSplit(dirname string, inclDotDirs bool) ([]os.FileInfo, []os.FileInfo, error)

func ReadFileJSON

func ReadFileJSON(file string, v interface{}) error

ReadFileJSON reads and unmarshals a file.

func ReaderToBytes

func ReaderToBytes(ior io.Reader) ([]byte, error)

ReaderToBytes reads from an io.Reader, e.g. io.ReadCloser

func RemoveAllChildren

func RemoveAllChildren(dir string) error

func SplitBest

func SplitBest(path string) (dir, file string, err error)

func SplitBetter

func SplitBetter(path string) (dir, file string)

func WriteFileJSON

func WriteFileJSON(filepath string, data interface{}, perm os.FileMode, prefix, indent string) error

Types

type FileInfoMore

type FileInfoMore struct {
	FileInfo os.FileInfo
	ModAge   time.Duration
}

func NewFileInfoMoreFromPath

func NewFileInfoMoreFromPath(path string) (FileInfoMore, error)

type FileType

type FileType int
const (
	File FileType = iota
	Directory
	Any
)

type FileWriter

type FileWriter struct {
	File   *os.File
	Writer *bufio.Writer
}

func NewFileWriter

func NewFileWriter(path string) (FileWriter, error)

func (*FileWriter) Close

func (f *FileWriter) Close()

Jump to

Keyboard shortcuts

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