Skip to content

conversion-library / sizeConversionArray

Function: sizeConversionArray()

ts
function sizeConversionArray(value: number, fromUnit: SizeUnitType): SizeConversionArrayItemType[]

sizeConversionArray

version: v0.0.12+

Parameters

value: number

Enter value

fromUnit: SizeUnitType

Enter value unit B/KB/MB/GB/TB/PB/EB/ZB/YB

Returns

SizeConversionArrayItemType[]

size array, { value: number, unit: SizeUnitType, label: string }[]

Example

ts
sizeConversionArray(5000, 'GB')
[
  { value: 4, unit: 'TB', label: '4TB' },
  { value: 904, unit: 'GB', label: '904GB' }
]

Defined in

lib/size-conversion/sizeConversionArray.ts:25