fs

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirsExist

func DirsExist(paths ...string) error

DirsExist runs DirExists for multiple paths.

func FileExists

func FileExists(path string) bool

FileExists returns true if path exist and is a file

func FileReadLine

func FileReadLine(path string) (string, error)

FileReadLine reads the first line from a file

func FileSize

func FileSize(path string) (int64, error)

FileSize returns the size of a file in Bytes

func FindFileInParentDirs

func FindFileInParentDirs(startPath, filename string) (string, error)

FindFileInParentDirs finds a directory that contains filename. The function starts searching in startPath and then checks recursively each parent directory for the file. It returns the absolute path to the first found directory contains the file. If it reaches the root directory without finding the file it returns os.ErrNotExist

func FindFilesInSubDir

func FindFilesInSubDir(searchDir, filename string, maxdepth int) ([]string, error)

FindFilesInSubDir returns all directories that contain filename that are in searchDir. The function descends up to maxdepth levels of directories below searchDir

func IsDir

func IsDir(path string) (bool, error)

IsDir returns true if the path is a directory. If the directory does not exist, the error from os.Stat() is returned.

func IsFile

func IsFile(path string) (bool, error)

IsFile returns true if path is a file. If the path does not exist an error is returned

func IsRegularFile added in v0.11.1

func IsRegularFile(path string) (bool, error)

IsRegularFile returns true if path is a regular file. If the directory does not exist, the error from os.Stat() is returned.

func Mkdir added in v0.11.1

func Mkdir(path string) error

Mkdir creates recursively directories

func PathsJoin

func PathsJoin(rootPath string, relPaths []string) []string

PathsJoin returns a list where all paths in relPaths are prefixed with rootPath

func SameFile added in v0.11.1

func SameFile(a, b string) (bool, error)

SameFile calls os.Samefile(), if one of the files does not exist, the error from os.Stat() is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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