filepath

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDirectory

func IsDirectory(path string, statFunc fs.StatFunc) (bool, error)

IsDirectory checks whether the given path refers to a directory. If the path is a URL, it returns false with no error. The statFunc parameter allows for custom file stat implementations; if nil, os.Stat is used. Returns true if the path is a directory, false otherwise, along with any error encountered.

func IsURL

func IsURL(path string) bool

IsURL checks whether the given path string is a valid HTTP or HTTPS URL. It returns true if the path starts with "http" (case-insensitive) and can be parsed as a valid URL, otherwise it returns false.

func Join

func Join(elem ...string) string

Join concatenates the provided path elements into a single file path, separating them with a forward slash ('/'), and normalizes the resulting path. It returns the normalized file path as a string.

func NormalizeFilePath

func NormalizeFilePath(path string) string

NormalizeFilePath normalizes a file path by removing any prefix before a colon (':'), and replacing all backslashes ('\') with forward slashes ('/'). This is useful for ensuring consistent file path formatting across different operating systems.

func PathExists

func PathExists(path string, statFunc fs.StatFunc) bool

PathExists checks whether the specified file or directory exists at the given path. It uses the provided statFunc to retrieve file information. If statFunc is nil, os.Stat is used by default. Returns true if the path exists, false otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

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