filex

package
v1.0.75 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DirectoryPermission = 0700 // Default directory permissions given on creation
	FilePermission      = 0644 // Default file permissions given on creation
)

Variables

This section is empty.

Functions

func CopyBuffered

func CopyBuffered(r io.Reader, w io.Writer) error

CopyBuffered copies the input io.Reader to the given output io.Writer using a buffer of 32KB

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies the src file to the dst, using a buffered read/write

func DirExists

func DirExists(path string) bool

DirExists returns true if the specified path exists AND is a directory, false otherwise

func FileExists

func FileExists(path string) bool

FileExists returns true if the specified path exists AND is a file, false otherwise

func GetCWD

func GetCWD() string

GetCWD returns the path a string of the given current working directory

func GetName

func GetName(path string) (string, bool)

GetName returns the name of the file/directory at the given path

func NextAvailablePath

func NextAvailablePath(path string, ext ...string) string

NextAvailablePath returns the next available path for the given path, optionally with an extension For files without an extension or directories, the extension can be omitted In case an extension is provided, but it does not match the intended path, it will be ignored Example: NextAvailablePath("foo.png") -> "foo.png" if foo.png does not exist

NextAvailablePath("foo.png", ".png") -> "foo1.png" if foo.png does exist
NextAvailablePath("foo.png", ".png") -> "foo12.png" if foo1.png - foo11.png do exist

func PathExists

func PathExists(path string) bool

PathExists returns true if the specified path exists, false otherwise

func SanitizePath

func SanitizePath(value string) string

SanitizePath - Sanitize string so it can be used as a valid file name

Types

type Entry

type Entry byte
const (
	File Entry = iota
	Directory
)

type Type

type Type string
const (
	Image     Type = "IMAGE"
	JSON      Type = "JSON"
	PNG       Type = "PNG"
	Thumbnail Type = "THUMBNAIL"
)

Jump to

Keyboard shortcuts

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