fileutil

package
v0.0.0-...-e311a6d Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Basename

func Basename(fp string) string

Basename returns the last element of path. /path/to/file.txt -> file.txt

func CreateFile

func CreateFile(fp string) (*os.File, error)

func Dir

func Dir(fp string) string

Dir returns the directory of path. /path/to/file.txt -> /path/to

func EnsureDir

func EnsureDir(fp string, mode fs.FileMode) error

EnsureDir creates the necessary parent directory.

func ExeDir

func ExeDir() string

ExeDir returns the directory of the executable file.

func ExePath

func ExePath() string

ExePath returns the absolute path of the executable file.

func Ext

func Ext(fp string) string

Ext returns the file name extension used by path. /path/to/file.txt -> .txt

func FileMD5

func FileMD5(fp string) (string, error)

FileMD5 returns the md5 value of the file.

func FileMTime

func FileMTime(fp string) (int64, error)

FileMTime returns the last modified time of the file. 10-digit timestamp

func FileSize

func FileSize(fp string) (int64, error)

func IsExist

func IsExist(fp string) bool

IsExist checks whether a file or directory exists.

func IsFile

func IsFile(fp string) bool

IsFile checks whether the path is a file,

func RealPath

func RealPath(fp string) (string, error)

RealPath returns the absolute path of the file.

func RemoveFile

func RemoveFile(fp string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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