fastdu

package
v0.0.0-...-a4fceb9 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortedKeys

func SortedKeys(m map[string]int64) []string

SortedKeys takes a dictionary and returns a sorted slice of keys

Types

type DUtil

type DUtil interface {
	Inc(path string, size int64)       // increment totals per dir
	WriteMeta(file string)             // write Meta data in json format
	WriteMetaSortedByDate(file string) // write meta data sorted by date
	WriteMetaSortedBySize(file string) // write meta data sorted by file size

}

DUtil is an interface to describe utilities that are used for directory traversal and collect meta data

type DirCount

type DirCount struct {
	Meta map[string]*Meta // file name (not absolute path) -> meta data map
	// contains filtered or unexported fields
}

DirCount is used to store byte totals for all files in specified dir

func NewDirCount

func NewDirCount() *DirCount

NewDirCount is a function that returns a new DirCount that implements DUtil

func (*DirCount) AddFile

func (d *DirCount) AddFile(file string, fInfo os.FileInfo)

AddFile can accept a path to dir or file as first argument

func (*DirCount) GetTop

func (d *DirCount) GetTop() map[string]int64

GetTop returns aggregated totals for the top level directories

func (*DirCount) Inc

func (d *DirCount) Inc(path string, size int64)

Inc increases the cumulative file size count by directory

func (*DirCount) PrintFiles

func (d *DirCount) PrintFiles(topFiles int, summary bool)

PrintFiles prints top files disk usage similar to du

func (*DirCount) WriteMeta

func (d *DirCount) WriteMeta(file string)

WriteMeta is used to write meta data to specified file

func (*DirCount) WriteMetaSortedByDate

func (d *DirCount) WriteMetaSortedByDate(file string)

WriteMetaSortedByDate prints meta data sorted by date

func (*DirCount) WriteMetaSortedBySize

func (d *DirCount) WriteMetaSortedBySize(file string)

WriteMetaSortedBySize writes meta data sorted by file size

type Meta

type Meta struct {
	Name    string // base file name
	Size    int64
	Modtime time.Time
	types.Type
	Exif exif.Exif
	Dups []string // potential list of duplicates
}

Meta stores metadata about the file such as os.stat info, filetype info

type SortedFileBySize

type SortedFileBySize []*Meta

SortedFileBySize sorts files by size held in metadata

func (SortedFileBySize) Len

func (s SortedFileBySize) Len() int

func (SortedFileBySize) Less

func (s SortedFileBySize) Less(i, j int) bool

func (SortedFileBySize) Swap

func (s SortedFileBySize) Swap(i, j int)

type SortedMetaByDate

type SortedMetaByDate []*Meta

SortedMetaByDate interface types for SortedMetaByDate

func (SortedMetaByDate) Len

func (s SortedMetaByDate) Len() int

func (SortedMetaByDate) Less

func (s SortedMetaByDate) Less(i, j int) bool

func (SortedMetaByDate) Swap

func (s SortedMetaByDate) Swap(i, j int)

Jump to

Keyboard shortcuts

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