Documentation
¶
Index ¶
- Constants
- func Bytes(s uint64) string
- func ConvertBytesToUint64(b []byte) uint64
- func ConvertUint64ToBytes(u uint64) []byte
- func DecodeMsgPack(buf []byte, out interface{}) error
- func DirSize(path string) (int64, error)
- func EncodeMsgPack(in interface{}) (*bytes.Buffer, error)
- func FriendlyBytes(n uint64) string
- func IBytes(s uint64) string
- func ParseBytes(s string) (uint64, error)
- func PathExists(p string) bool
- func ResolvableAddress(addr string) (string, error)
Constants ¶
const ( Byte = 1 << (iota * 10) KiByte MiByte GiByte TiByte PiByte EiByte )
IEC Sizes. kibis of bits
const ( IByte = 1 KByte = IByte * 1000 MByte = KByte * 1000 GByte = MByte * 1000 TByte = GByte * 1000 PByte = TByte * 1000 EByte = PByte * 1000 )
SI Sizes.
Variables ¶
This section is empty.
Functions ¶
func Bytes ¶
Bytes produces a human readable representation of an SI size.
See also: ParseBytes.
Bytes(82854982) -> 83 MB
func ConvertUint64ToBytes ¶
ConvertUint64ToBytes converts uint64 to bytes of 64 bits
func DecodeMsgPack ¶
Decode reverses the encode operation on a byte slice input
func EncodeMsgPack ¶
Encode writes an encoded object to a new bytes buffer
func FriendlyBytes ¶
FriendlyBytes produces a human readable representation of an SI size
func IBytes ¶
IBytes produces a human readable representation of an IEC size.
See also: ParseBytes.
IBytes(82854982) -> 79 MiB
func ParseBytes ¶
ParseBytes parses a string representation of bytes into the number of bytes it represents.
See Also: Bytes, IBytes.
ParseBytes("42 MB") -> 42000000, nil ParseBytes("42 mib") -> 44040192, nil
func ResolvableAddress ¶
ResolvableAddress checks if the host in the given address is DNS-resolvable. Returns the host if resolvable, an error if not.
Types ¶
This section is empty.