@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
50 lines (49 loc) • 1.57 kB
TypeScript
/**
* The base of byte representation to use in conversion.
*/
export declare enum MediaConversionBase {
Binary = 1024,
Decimal = 1000
}
/**
* Methods for converting media units (i.e. bytes) into display formats.
* @dynamic
*/
export declare class MediaConversion {
private static cachedIecUnitMap;
private static get iecUnitMap();
/**
* Converts the supplied bytes into the appropriate display string.
*
* @param bytes The raw number of bytes.
* @param base The byte representation base to use in conversion.
*/
static getConvertedValue(bytes: number, base: MediaConversionBase): string;
/**
* Converts the raw bytes into the number corresponding to it's appropriate display value.
*
* @param bytes The raw number of bytes.
* @param base the byte representation base to use in conversion.
* @param unit The desired unit of conversion.
* @param floor Whether or not to floor the result.
*/
private static convertValue;
/**
* Gets the appropriate unit for a number of raw bytes in a particular base.
*
* @param bytes The raw number of bytes.
* @param base The byte representation base to use in conversion.
*/
private static getUnit;
}
/**
* Methods for converting percentages into display formats.
*/
export declare class PercentageConversion {
/**
* Converts the given value to a percentage.
*
* @param value the value to display as percent srring.
*/
static getPercentageDisplayValue(value: number): string;
}