utils

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB = 1 << (10 * iota) // 1024
	MB
	GB
	TB
)

Variables

This section is empty.

Functions

func Exist

func Exist(filesPath string) bool

func FormatBytesProgress

func FormatBytesProgress(bytesCompleted, totalLength int64) string

FormatBytesProgress formats the bytes completed and total length into a string representation with the appropriate suffix.

func FormatDuration

func FormatDuration(duration time.Duration) string

FormatDuration formats a duration in a human-readable format.

func GetDateTime

func GetDateTime() string

GetDateTime returns the current date and time formatted as "DD/MM/YYYY HH:MM:SS".

func GetDefaultDownloadFolder

func GetDefaultDownloadFolder() (string, error)

func GetHomeDir

func GetHomeDir() (string, error)

func OpenDirectory

func OpenDirectory(dir string) error

OpenDirectory opens the given directory in the default file manager. (macos, linux, windows)

Types

type Size

type Size struct {
	Width  int
	Height int
}

func NewSize

func NewSize(width, height int) Size

func (*Size) Resize

func (s *Size) Resize(width, height int) *Size

func (*Size) ResizeHeight

func (s *Size) ResizeHeight(height int) *Size

func (*Size) ResizeWidth

func (s *Size) ResizeWidth(width int) *Size

Jump to

Keyboard shortcuts

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