Documentation ¶
Index ¶
- func DirExists(path string) (bool, error)
- func EmptyDir(path string) error
- func EnsureDir(path string) error
- func EnsureDirAll(path string) error
- func FileExists(path string) (bool, error)
- func FileType(filePath string) (types.Type, error)
- func GetHomeDirectory() string
- func GetIntraDir(pattern string, depth, length int) string
- func GetParent(path string) *string
- func IsZipFileUncompressed(path string) (bool, error)
- func ListDir(path string) []string
- func MatchEntries(dir, pattern string) ([]string, error)
- func RemoveDir(path string) error
- func SafeMove(src, dst string) error
- func ServeFileNoCache(w http.ResponseWriter, r *http.Request, filepath string)
- func Touch(path string) error
- func WriteFile(path string, file []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureDirAll ¶
EnsureDirAll will create a directory at the given path along with any necessary parents if they don't already exist.
func FileExists ¶
FileExists returns true if the given path exists.
func GetHomeDirectory ¶
func GetHomeDirectory() string
GetHomeDirectory returns the path of the user's home directory. ~ on Unix and C:\Users\UserName on Windows.
func GetIntraDir ¶
GetIntraDir returns a string that can be added to filepath.Join to implement directory depth, "" on error eg given a pattern of 0af63ce3c99162e9df23a997f62621c5 and a depth of 2 length of 3 returns 0af/63c or 0af\63c ( dependin on os) that can be later used like this filepath.Join(directory, intradir, basename).
func IsZipFileUncompressed ¶
IsZipFileUncompressed returns true if zip file in path is using 0 compression level.
func MatchEntries ¶
MatchEntries returns a string slice of the entries in directory dir which match the regexp pattern. On error an empty slice is returned MatchEntries isn't recursive, only the specific 'dir' is searched without being expanded.
func ServeFileNoCache ¶
func ServeFileNoCache(w http.ResponseWriter, r *http.Request, filepath string)
ServeFileNoCache serves the provided file, ensuring that the response contains headers to prevent caching.
Types ¶
This section is empty.