Documentation ¶
Overview ¶
File System Tools Dealing with directories (defining as a collection of files/directories here)
File System Tools Dealing with individual files here.
Index ¶
- Constants
- type BytesSI
- type Directory
- func (d *Directory) Error() string
- func (d *Directory) File(i int) File
- func (d *Directory) Files() []File
- func (d *Directory) IsEmpty() bool
- func (d *Directory) IsProblem() bool
- func (d *Directory) Read(p *Path, showHidden bool)
- func (d *Directory) Size() int
- func (d *Directory) Sort(method SortMethod)
- type File
- type Path
- type SortMethod
Constants ¶
const (
KB, MB, GB, TB, PB, EB, ZB, YB = 1e3, 1e6, 1e9, 1e12, 1e15, 1e18, 1e21, 1e24
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BytesSI ¶ added in v0.1.0
type BytesSI float64
this type implementations based on https://golang.org/doc/effective_go
type Directory ¶
type Directory struct {
// contains filtered or unexported fields
}
Directory{} should stay identical to reading an empty directory
func NewDirectory ¶
func NewDirectoryFromSlice ¶ added in v0.1.0
This is for tests.
func (*Directory) Sort ¶ added in v0.1.0
func (d *Directory) Sort(method SortMethod)
Sorts slice of Files in place.
type File ¶
type File struct { Name string Size BytesSI IsDir bool IsReg bool IsSymLink bool Time time.Time Perm fs.FileMode }
Should use custom enum to restrict supported file types Implements os.DirEntry SHould think about the cost/benefit of reimplimenting DirEntry methods vs just composing?
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
Path's job is to stay nice and neat instead of hoping string is formatted properly. Abstracting away from the base Go path stuff. *
func (*Path) Set ¶
Set() must always store an absolute path compatibile with the standard path/filepath pkg
type SortMethod ¶ added in v0.1.0
type SortMethod int
const ( NameAsc SortMethod = iota NameDesc DirectoryAsc DirectoryDesc )