humanize

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package humanize formats sizes and durations the way vrok shows them in the terminal and in the browser. Both surfaces use it so the numbers always agree.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(n int64) string

Bytes renders a byte count with binary units: 1536 -> "1.5 KB".

func ClockTime

func ClockTime(t time.Time) string

ClockTime renders a local wall-clock time, or "never" for the zero value. vrok uses it for "last access", where the time of day is what people look for rather than an elapsed duration.

func Duration

func Duration(d time.Duration) string

Duration renders a coarse, compact duration: "1h 42m", "34m", "45s". It is used for "expires in" countdowns, where sub-second precision is noise.

func Elapsed added in v0.2.0

func Elapsed(d time.Duration) string

Elapsed renders how long something took, keeping the next unit down: "45s", "1m 48s", "2h 5m". Duration rounds to one unit, which suits a countdown but would report a 1m 48s transfer as "1m".

Types

This section is empty.

Jump to

Keyboard shortcuts

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