Bookmark this: tool.io/convert/digital-storage/source-code
Convert Digital Storage Source Code
Browse the implementation files for Convert Digital Storage.tool.ts typescript
import { convertDigitalStorage as convertPortableDigitalStorage } from '@tool.io/tools/convert/digital-storage';
import { measureFactorOptions } from '../tool';
import { measureFactors } from './factors';
export const convertDigitalStorage = (
value: number,
from: string,
to: string
) => convertPortableDigitalStorage(value, from, to) ?? '';
export const Tool: TypeTool = {
name: 'Convert Digital Storage',
slug: 'convert/digital-storage',
tool: convertDigitalStorage,
intro:
'Convert digital storage between bits and bytes using distinct decimal SI and binary IEC units.',
i: [
{
example: '1',
label: 'Value',
placeholder: '1',
type: 'number'
},
{
example: 'GB',
label: 'From',
placeholder: 'Select the source storage unit',
options: measureFactorOptions(measureFactors, 'GB'),
type: 'select',
value: 'GB'
},
{
example: 'GiB',
label: 'To',
placeholder: 'Select the destination storage unit',
options: measureFactorOptions(measureFactors, 'GiB'),
type: 'select',
value: 'GiB'
}
],
o: [
{
example: '0.9313225746154785',
label: 'Digital storage',
placeholder: 'Converted storage',
render: 'textarea',
type: 'number'
}
],
swap: {
inputs: [1, 2],
name: 'Swap storage units',
state: false
},
alternative: [
{ title: 'Convert data rate', url: '/convert/data-rate' }
],
cite: [
{
title: 'SI Brochure — BIPM',
url: 'https://www.bipm.org/en/publications/si-brochure'
},
{
title: 'Binary prefixes — IEC',
url: 'https://www.iec.ch/prefixes-binary-multiples'
}
]
};
export default Tool;
Description
Browse the implementation files for Convert Digital Storage.