conversion-library / sizeConversionBase
Function: sizeConversionBase()
ts
function sizeConversionBase(
value: number,
fromUnit: SizeUnitType,
toUnit: SizeUnitType): number
sizeConversionBase
version: v0.0.12+Parameters
• value: number
Enter value
• fromUnit: SizeUnitType
Enter value unit B/KB/MB/GB/TB/PB/EB/ZB/YB
• toUnit: SizeUnitType
Enter target unit B/KB/MB/GB/TB/PB/EB/ZB/YB
Returns
number
target value
Example
ts
sizeConversionBase(1024, 'B', 'KB')
// 1
sizeConversionBase(20 * 1024, 'KB', 'MB')
// 20
sizeConversionBase(512, 'MB', 'GB')
// 0.5