Mike Rockétt

Human Bytes Beta

A package for V that converts bytes into human-friendly strings.

Repository: https://github.com/mikerockett/human_bytes

Readme

Based on work done by Sindre.

Usage:

import human_bytes { convert, convert_opt }
 
// Normal conversions
convert(10) // 10 B
convert(1001) // 1 kB
 
// Conversions with options
convert_opt(1001, signed: true) // +1 kB
convert_opt(1001, bits: true) // 1 kbit
convert_opt(1e16, binary: true) // 8.88 PiB
convert_opt(1025, bits: true, binary: true, signed: true) // +1 kibit

Published 18 July 2021 in vlang