fs

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: MPL-2.0 Imports: 13 Imported by: 21

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseName

func BaseName(path string) string

BaseName returns the file name without the directory or extension.

func Copy added in v1.1.0

func Copy(src, dst string) error

Copy src to dst. src may be a directory, file, or symlink.

func FileExists

func FileExists(path string) bool

FileExists returns true if the path points to a regular file.

func IsDir

func IsDir(path string) bool

IsDir returns true if the specified path exists and is a directory.

func LoadJSON

func LoadJSON(path string, data interface{}) error

LoadJSON data from the specified path.

func LoadYAML

func LoadYAML(path string, data interface{}) error

LoadYAML data from the specified path.

func MoveFile

func MoveFile(src, dst string) (err error)

MoveFile moves a file in the file system or across volumes, using rename if possible, but falling back to copying the file if not. This will error if either src or dst are not regular files.

func SanitizeName

func SanitizeName(name string) string

SanitizeName sanitizes a file name by replacing invalid characters.

func SaveJSON

func SaveJSON(path string, data interface{}, format bool) error

SaveJSON data to the specified path.

func SaveYAML

func SaveYAML(path string, data interface{}) error

SaveYAML data to the specified path.

func Split

func Split(path string) []string

Split a path into its component parts.

func TrimExtension

func TrimExtension(path string) string

TrimExtension trims any extension from the path.

func UnsanitizeName

func UnsanitizeName(name string) string

UnsanitizeName reverses the effects of a call to SanitizeName.

func Walk

func Walk(fs http.FileSystem, root string, walkFn filepath.WalkFunc) error

Walk performs the same function as filepath.Walk() does, but works on http.FileSystem objects.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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