dataSizeKit

package
v3.0.918 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B uint64 = 1

	KiB uint64 = 1 << 10

	MiB uint64 = 1 << 20

	GiB uint64 = 1 << 30

	TiB uint64 = 1 << 40

	PiB uint64 = 1 << 50

	EiB uint64 = 1 << 60
)

Variables

View Source
var (

	// ParseSiString SI标准(base 1000)
	ParseSiString func(size string) (uint64, error) = formatter.ParseDecimalBytes

	// ParseIecString IEC标准(base 1024)
	ParseIecString func(size string) (uint64, error) = formatter.ParseBinaryBytes
)

Functions

func ByteToGiB

func ByteToGiB(bytes uint64, placesArgs ...int32) float64

ByteToGiB

PS: IEC标准.

@param placesArgs 保留的小数位,默认: 2

func ByteToKiB

func ByteToKiB(bytes uint64, placesArgs ...int32) float64

ByteToKiB

PS: IEC标准.

@param placesArgs 保留的小数位,默认: 2

func ByteToMiB

func ByteToMiB(bytes uint64, placesArgs ...int32) float64

ByteToMiB

PS: IEC标准.

@param placesArgs 保留的小数位,默认: 2

func ToReadableIecString

func ToReadableIecString(size float64, precisionArgs ...int) string

ToReadableIecString IEC标准(base 1024)

   PS:
   (1) 采用IEC标准(国际电工委员会;https://blog.csdn.net/bioitee/article/details/120797739).
   (2) 1KB == 1024
   (3) 采用此标准: Windows的文件资源管理器、钉钉(Mac版和Windows版都是)、XManager和Tabby的可视化工具...

	@param precision 指定小数点后的位数,默认为2

func ToReadableSiString

func ToReadableSiString(size float64, precisionArgs ...int) string

ToReadableSiString SI标准(base 1000)

   PS:
   (1) 采用SI标准(国际单位制;https://blog.csdn.net/bioitee/article/details/120797739).
   (2) 1KB == 1000
   (3) 采用此标准: Mac的访达(Finder)...

	@param precision 指定小数点后的位数,默认为2

Types

This section is empty.

Jump to

Keyboard shortcuts

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