fs

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanSlashPath added in v0.11.0

func CleanSlashPath(path string) string

CleanSlashPath returns clean and slash path.

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherise, attempt to create a hard link between the two files. If that fails, copy the file contents from src to dst.

func Dir added in v0.11.0

func Dir(path string) string

Dir returns all but the last element of path, typically the path's directory. The result is a clean and slash path.

func Exists

func Exists(path string) (bool, error)

Exists returns whether the given file or directory exists

func GenCSVBooknamePattern added in v0.10.7

func GenCSVBooknamePattern(dir, bookName string) string

func HasSubdirPrefix added in v0.11.0

func HasSubdirPrefix(path string, subdirs []string) bool

HasSubdirPrefix returns whether the given path has the given prefix.

func IsSamePath added in v0.9.13

func IsSamePath(leftPath, rightPath string) bool

IsSamePath checks if two paths are same based on clean slash path.

func Join added in v0.11.0

func Join(elem ...string) string

Join joins any number of path elements into a clean and slash path.

func ParseCSVBooknamePatternFrom added in v0.10.7

func ParseCSVBooknamePatternFrom(filename string) (string, error)

func ParseCSVFilenamePattern added in v0.10.7

func ParseCSVFilenamePattern(filename string) (bookName, sheetName string, err error)

func RangeFilesByFormat added in v0.10.7

func RangeFilesByFormat(dir string, fmt format.Format, callback func(bookPath string) error) error

RangeFilesByFormat traveses the given directory with the given format, and invoke the given callback for each file.

func Rel added in v0.11.0

func Rel(basepath string, targetpath string) (string, error)

Rel returns relative clean slash path.

func RewriteSubdir added in v0.9.7

func RewriteSubdir(path string, subdirRewrites map[string]string) string

RewriteSubdir replaces path's subdir part with the given subdirs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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