Function useFormatBytes

  • 字节单位转换 'Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'

    Parameters

    • value: number
    • decimal: number = 2

    Returns string | number

    Example

    useFormatBytes(123456789012345) // 112.28 TB
    useFormatBytes(1048576) // 1 MB
    useFormatBytes(0) // 0 Bytes
    useFormatBytes(104857610485761048576104857610485761048576) // Number too large