fs

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PreventDatalessMaterialization added in v0.3.0

func PreventDatalessMaterialization() error

PreventDatalessMaterialization is a no-op on platforms other than macOS.

Types

type ByApparentSize

type ByApparentSize Files

ByApparentSize sorts files by apparent size

func (ByApparentSize) Len

func (f ByApparentSize) Len() int

func (ByApparentSize) Less

func (f ByApparentSize) Less(i, j int) bool

func (ByApparentSize) Swap

func (f ByApparentSize) Swap(i, j int)

type ByItemCount

type ByItemCount Files

ByItemCount sorts files by item count

func (ByItemCount) Len

func (f ByItemCount) Len() int

func (ByItemCount) Less

func (f ByItemCount) Less(i, j int) bool

func (ByItemCount) Swap

func (f ByItemCount) Swap(i, j int)

type ByMtime

type ByMtime Files

ByMtime sorts files by name

func (ByMtime) Len

func (f ByMtime) Len() int

func (ByMtime) Less

func (f ByMtime) Less(i, j int) bool

func (ByMtime) Swap

func (f ByMtime) Swap(i, j int)

type ByName

type ByName Files

ByName sorts files by name

func (ByName) Len

func (f ByName) Len() int

func (ByName) Less

func (f ByName) Less(i, j int) bool

func (ByName) Swap

func (f ByName) Swap(i, j int)

type Files

type Files []Item

Files - slice of pointers to File

func (Files) FindByName

func (f Files) FindByName(name string) (int, bool)

FindByName searches name in Files and returns its index

func (Files) IndexOf

func (f Files) IndexOf(file Item) (int, bool)

IndexOf searches File in Files and returns its index

func (Files) Len

func (f Files) Len() int

func (Files) Less

func (f Files) Less(i, j int) bool

func (Files) Remove

func (f Files) Remove(file Item) Files

Remove removes File from Files

func (Files) RemoveByName

func (f Files) RemoveByName(name string) Files

RemoveByName removes File from Files

func (Files) Swap

func (f Files) Swap(i, j int)

type HardLinkedItems

type HardLinkedItems map[uint64]Files

HardLinkedItems maps inode number to array of all hard linked items

type Item

type Item interface {
	GetPath() string
	GetName() string
	GetFlag() rune
	IsDir() bool
	GetSize() int64
	GetType() string
	GetUsage() int64
	GetMtime() time.Time
	GetItemCount() int64
	GetParent() Item
	SetParent(Item)
	GetMultiLinkedInode() uint64
	EncodeJSON(writer io.Writer, topLevel bool, attributes JSONAttributes) error
	GetItemStats(linkedItems HardLinkedItems, filteringFiles bool) (itemCount int64, size, usage int64)
	UpdateStats(linkedItems HardLinkedItems)
	UpdateStatsWithFileFiltering(linkedItems HardLinkedItems)
	AddFile(Item)
	GetFiles(SortBy, SortOrder) iter.Seq[Item]
	GetFilesLocked(SortBy, SortOrder) iter.Seq[Item]
	RemoveFile(Item)
	RemoveFileByName(name string)
	RLock() func()
}

Item is a FS item (file or dir)

type JSONAttributes added in v0.3.0

type JSONAttributes map[string]struct{}

JSONAttributes selects optional attributes written to an analysis export. A nil set preserves the complete legacy export.

func (JSONAttributes) Includes added in v0.3.0

func (attributes JSONAttributes) Includes(attribute string) bool

Includes reports whether an optional JSON attribute should be written.

type SortBy

type SortBy int

SortBy represents the field to sort files by

const (
	SortBySize SortBy = iota
	SortByName
	SortByItemCount
	SortByMtime
	SortByApparentSize
)

func ParseSortBy

func ParseSortBy(s string) SortBy

ParseSortBy converts a string to SortBy

type SortOrder

type SortOrder int

SortOrder represents the sort direction

const (
	SortAsc SortOrder = iota
	SortDesc
)

func ParseSortOrder

func ParseSortOrder(s string) SortOrder

ParseSortOrder converts a string to SortOrder

type SymlinkItem added in v0.3.0

type SymlinkItem interface {
	GetSymlinkTarget() string
}

SymlinkItem is an optional interface implemented by items that carry a symlink target. Consumers type-assert an Item to it to display the target (e.g. "name -> target"); items that are not symlinks return an empty string.

Jump to

Keyboard shortcuts

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