fsutils

package
v0.0.0-...-c5e0fe0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFile      = errors.New("path is not a file")
	ErrNotDir       = errors.New("path is not a directory")
	ErrDirNotExists = errors.New("directory not exists")
)

Functions

func Exists

func Exists(path string) (bool, error)

Returns if given path exists and any os error occurs (except os.ErrNotExist). Before using the value check error first.

func ExistsDir

func ExistsDir(path string) (bool, error)

Returns if a file exists in given path and any os error occurs (except os.ErrNotExist). Returns ErrNotFile if the path is an existing directory. Before using the value check error first. For directory checks better use ExistsDir.

func ExistsFile

func ExistsFile(path string) (bool, error)

Returns if a file exists in given path and any os error occurs (except os.ErrNotExist). Returns ErrNotFile if the path is an existing directory. Before using the value check error first. For directory checks better use ExistsDir.

func HumanizedSizeB10

func HumanizedSizeB10(b int64) string

Base 10 humanized byte strings. Rounding done at number side only. Example: 999.9 kB will be shown as 999.9 kB but 999.91 kB will be shown as 1000.kB not 1.0 MB

func HumanizedSizeB2

func HumanizedSizeB2(b int64) string

Base 2 humanized byte strings. Rounding done at number side only. Example: 1023.9 kB will be shown as 1023.9 kB but 1023.91 kB will be shown as 1024.kB not 1.0 MB

func TouchAll

func TouchAll(p string) error

TouchAll mimics os.MkdirAll. Creates a file if it not exists in given path. Returns corresponding error if given dir not exists or not a dir at all.

Types

This section is empty.

Jump to

Keyboard shortcuts

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