fsutil

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFile

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

CreateFile create a file without truncate

func FileExist

func FileExist(path string) (exist bool, err error)

FileExist is file Exist

func GetFileTime

func GetFileTime(path string) (cTime time.Time, aTime time.Time, mTime time.Time, err error)

GetFileTime get the creation time, last access time, last modify time of the path

func GetFileTimeBySys

func GetFileTimeBySys(sys any) (cTime time.Time, aTime time.Time, mTime time.Time, err error)

GetFileTimeBySys get the creation time, last access time, last modify time of the FileInfo.Sys()

func IsDir

func IsDir(path string) (bool, error)

IsDir the path is directory or not

func IsEOF

func IsEOF(err error) bool

IsEOF whether the error is io.EOF

func IsNonEOF

func IsNonEOF(err error) bool

IsNonEOF whether the error is not io.EOF and is not nil

func IsSub

func IsSub(parent, child string) (bool, error)

IsSub whether it is a subdirectory of the parent

func IsSymlink(path string) (bool, error)

IsSymlink the path is a symbolic link or not

func IsSymlinkMode

func IsSymlinkMode(mode fs.FileMode) bool

IsSymlinkMode check the mode is a symbolic link or not

func IsSymlinkSupported

func IsSymlinkSupported() bool

IsSymlinkSupported checks if the system supports symbolic links

func OpenRWFile

func OpenRWFile(name string) (*os.File, error)

OpenRWFile open a file with read write mode

func Readlink(name string) (string, error)

Readlink returns the destination of the named symbolic link

func SafePath

func SafePath(path string) string

SafePath encode some special characters for the path like "?", "#" etc.

func Symlink(oldname, newname string) error

Symlink create a symbolic link

func SymlinkText

func SymlinkText(realPath string) string

SymlinkText build custom symlink text content

Types

type GetFileTimeFunc

type GetFileTimeFunc func(path string) (cTime time.Time, aTime time.Time, mTime time.Time, err error)

GetFileTimeFunc the function prototype of GetFileTime

type IsDirFunc

type IsDirFunc func(path string) (bool, error)

IsDirFunc the function prototype of IsDir

type StatFunc

type StatFunc func(name string) (fs.FileInfo, error)

StatFunc the function prototype of os.Stat

Jump to

Keyboard shortcuts

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