fsutil

package
v1.40.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	O_ModePerm fs.FileMode = 511

	// O_TRUNC = os.O_WRONLY|os.O_TRUNC|os.O_CREATE
	O_TRUNC int = 577

	// O_RDWTRUNC = os.O_RDWR|os.O_CREATE|os.O_TRUNC
	O_RDWTRUNC int = 578

	// O_RDONLY = os.O_RDONLY
	O_RDONLY int = 0

	// O_WROC = os.O_WRONLY|os.O_CREATE
	O_WROC int = 65
)

Variables

View Source
var (
	ErrNotExist error = errors.New("no file/folder found")
	ErrMethods  error = errors.New("don't use weird methods")
)

Functions

func CleanFile added in v1.19.0

func CleanFile(path string) error

func CopyAll added in v1.5.0

func CopyAll(src, dst string) error

func Create added in v1.13.0

func Create(v string) (*os.File, error)

func IsDir added in v0.0.11

func IsDir(path string) bool

This function will check if the target is a directory.

**When the target does not exist or other errors occur, it will return `false`**

func IsExist added in v1.5.0

func IsExist(path string) bool

This function checks if the target exists.

func IsFile added in v0.0.11

func IsFile(path string) bool

func Mkdir added in v1.5.0

func Mkdir(path string, mode ...fs.FileMode) error

func Move added in v1.11.0

func Move(src, dst string) error

func Open added in v1.7.0

func Open(v string) (*os.File, error)

Open opens the named file for reading.

If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY.

If there is an error, it will be of type *PathError.

func OpenRead added in v1.7.0

func OpenRead(v string) ([]byte, error)

func OpenWrite added in v1.40.0

func OpenWrite(v string) (*os.File, error)

func ReadDir added in v1.5.0

func ReadDir(path string) []string

func ReadDirAll added in v1.5.0

func ReadDirAll(path string) []string

func ReadDirInfo added in v1.17.0

func ReadDirInfo(path string) []fs.FileInfo

func ReadDirRaw added in v1.5.0

func ReadDirRaw(path string) ([]fs.DirEntry, error)

func ReaderWriter added in v1.19.0

func ReaderWriter(w io.Reader, r io.Writer) (*bufio.Reader, *bufio.Writer)

func Remove added in v1.6.0

func Remove(v string) error
func Symlink(src, dst string) error

func TruncWrite

func TruncWrite(path string, d any) error

func Write

func Write(path string, d any) error

Types

This section is empty.

Directories

Path Synopsis
zip

Jump to

Keyboard shortcuts

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