file

package module
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 16 Imported by: 9

README

File

Provides

  • native file utils
  • file permissions
  • mimetypes
  • sizes
  • file meta data

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available(path string) bool

func CleanRotatedByCount added in v0.0.6

func CleanRotatedByCount(fileName string, max int) error

func CleanRotatedByDays added in v0.0.6

func CleanRotatedByDays(fileName string, days int) error

func CopyDir

func CopyDir(source, dest string) (err error)

func CopyFile

func CopyFile(source string, dest string) (err error)

func Delete

func Delete(path string) bool

func DeleteAll

func DeleteAll(path string) bool

func ExpandPath

func ExpandPath(filepath string) (expandedPath string)

func FileAvailable

func FileAvailable(path string) bool

func FixPath

func FixPath(path string) string

func HomeFolder

func HomeFolder() string

func ListSeparator

func ListSeparator() string

func MkDir

func MkDir(path string)

MkDir create a directory if it doesn't exist passing in a FileMode such as os.ModePerm

func Name

func Name(path string) string

func PathOnly

func PathOnly(path string) string

func PathSeparator

func PathSeparator() string

func RotateFiles added in v0.0.6

func RotateFiles(fileName string) error

func SizeAs

func SizeAs(size int64, szType filesize.SizeTypes, si bool) float64

Types

type ByNumericalFilename added in v0.0.6

type ByNumericalFilename []os.FileInfo

func (ByNumericalFilename) Len added in v0.0.6

func (nf ByNumericalFilename) Len() int

func (ByNumericalFilename) Less added in v0.0.6

func (nf ByNumericalFilename) Less(i, j int) bool

func (ByNumericalFilename) Swap added in v0.0.6

func (nf ByNumericalFilename) Swap(i, j int)

type ByNumericalFilenameRev added in v0.0.6

type ByNumericalFilenameRev []os.FileInfo

func (ByNumericalFilenameRev) Len added in v0.0.6

func (nf ByNumericalFilenameRev) Len() int

func (ByNumericalFilenameRev) Less added in v0.0.6

func (nf ByNumericalFilenameRev) Less(i, j int) bool

func (ByNumericalFilenameRev) Swap added in v0.0.6

func (nf ByNumericalFilenameRev) Swap(i, j int)

type Exif

type Exif interface {
	Exif(fileName string)
	ReadLatLongData(f *os.File)
	ReadALLDataAsJSON(f *os.File)
}

type File

type File interface {
	Available() bool
	Delete() bool
	DeleteAll() bool
	Dir() bool
	Type() string
	Path() string
	PathOnly() string
	Name() string
	Size() int64
	Hash(hasher hash.Hasher, rebuild bool) []byte
	HRByteCount(si bool) string
	SetMeta(m Meta)
	Decode(enctype encodeenum.Encoding) []byte
	Encode(enctype encodeenum.Encoding) string
}

type Image

type Image interface {
	Dimensions(fileName string) (int, int)
}

type Meta

type Meta interface {
	Hidden() bool
	NamedPipe() bool
	Regular() bool
	SymLink() bool
	LastMod() int64
	Permissions() fileperm.PermissionBits
	Times() (time.Time, time.Time, time.Time, error)
}

Directories

Path Synopsis
https://github.com/phayes/permbits/blob/master/permbits.go
https://github.com/phayes/permbits/blob/master/permbits.go

Jump to

Keyboard shortcuts

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