Help us shape the future of Go! Take the 2026 Go Developer Survey

utils

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatBytes

func FormatBytes(bytes int64) string

FormatBytes converts a byte count to a human-readable string using binary units (1024).

func MaskAccountID

func MaskAccountID(accountID string) string

MaskAccountID masks sensitive account ID information, showing only the first 4 and last 4 characters with asterisks in between.

Types

type ProgressReader

type ProgressReader struct {
	io.Reader
	Progress *TransferProgress
}

func (*ProgressReader) Read

func (pr *ProgressReader) Read(p []byte) (int, error)

type ProgressWriter

type ProgressWriter struct {
	io.Writer
	Progress *TransferProgress
}

func (*ProgressWriter) Write

func (pw *ProgressWriter) Write(p []byte) (int, error)

type TransferProgress

type TransferProgress struct {
	Total     int64
	Transfer  int64
	StartTime time.Time
	Speed     float64 // bytes per second
	Width     int
}

func NewTransferProgress

func NewTransferProgress(total int64) *TransferProgress

func (*TransferProgress) Add

func (p *TransferProgress) Add(n int64)

func (*TransferProgress) ETA

func (p *TransferProgress) ETA() time.Duration

func (*TransferProgress) FormatBar

func (p *TransferProgress) FormatBar() string

func (*TransferProgress) Percent

func (p *TransferProgress) Percent() float64

func (*TransferProgress) PrintTo

func (p *TransferProgress) PrintTo(w io.Writer)

Jump to

Keyboard shortcuts

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