fse

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package fse provides additional filesystem functions which extend the capability of stdlib

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteDirIfEmpty

func DeleteDirIfEmpty(dir string) error

DeleteDirIfEmpty deletes a directory if it's empty

func DeleteFileDirIfEmpty

func DeleteFileDirIfEmpty(fp string) error

DeleteFileDirIfEmpty deletes the parent directory for a specified filepath if it's empty

func EnsureDir

func EnsureDir(dir string) error

EnsureDir ensures a directory exists on the filesystem

func EnsureFileDir

func EnsureFileDir(fp string) error

EnsureFileDir ensures the parent directory of the file exists on the filesystem

func EnsureWriteFile

func EnsureWriteFile(filename string, data []byte, perm fs.FileMode) error

EnsureWriteFile performs os.WriteFile but ensures that all directories leading up to the file will be created

func Exists

func Exists(fp string) bool

Exists returns whether a file exists on the filesystem

func Filename

func Filename(fp string) string

Filename returns a file's name without extensions given its filepath

func FilenameWithExt

func FilenameWithExt(fp string) string

FilenameWithExt returns a file's name with its extensions given its filepath

func Sanitise

func Sanitise(input string) string

Sanitise cleans up an input filename to ensure it's save for saving to the filesystem

Types

This section is empty.

Jump to

Keyboard shortcuts

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