files

package
v1.9.7 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootDir   = "."
	ParentDir = ".."
)
View Source
const (
	MetricFactor = 1000
	BinaryFactor = 1024
)
View Source
const (
	Byte = 1

	KiloByte = MetricFactor * Byte
	MegaByte = MetricFactor * KiloByte
	GigaByte = MetricFactor * MegaByte
	TeraByte = MetricFactor * GigaByte
	PetaByte = MetricFactor * TeraByte
	ExaByte  = MetricFactor * PetaByte

	KibiByte = BinaryFactor * Byte
	MebiByte = BinaryFactor * KibiByte
	GibiByte = BinaryFactor * MebiByte
	TebiByte = BinaryFactor * GibiByte
	PebiByte = BinaryFactor * TebiByte
	ExbiByte = BinaryFactor * PebiByte
)
View Source
const ShortestLengthPrecision = -1

Variables

This section is empty.

Functions

func Compare added in v1.3.0

func Compare(x, y File) int

func FormatSizeBinary added in v1.8.25

func FormatSizeBinary(size float64, precision int) string

func FormatSizeMetric added in v1.8.25

func FormatSizeMetric(size float64, precision int) string

func Sort added in v1.3.0

func Sort(files []File)

Types

type Controller added in v1.5.0

type Controller struct {
	// contains filtered or unexported fields
}

func NewController added in v1.5.0

func NewController(fileSystem fs.FS, config ControllerConfig) *Controller

func (*Controller) ListFiles added in v1.8.10

func (c *Controller) ListFiles() http.Handler

func (*Controller) UploadFile added in v1.8.10

func (c *Controller) UploadFile() http.Handler

type ControllerConfig added in v1.8.0

type ControllerConfig struct {
	FilesURL         string
	ExcludePattern   *regexp.Regexp
	Uploads          bool
	UploadsDir       string
	UploadsTimestamp bool
	Version          string
}

type File added in v1.3.0

type File struct {
	Path  string `json:"path"`
	Name  string `json:"name"`
	Size  string `json:"size,omitempty"`
	IsDir bool   `json:"is_dir"`
}

Jump to

Keyboard shortcuts

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