@datalayer/core
Version:
[](https://datalayer.io)
18 lines (17 loc) • 637 B
TypeScript
/**
* The type of unit used for reporting memory usage.
*/
export type MemoryUnit = 'B' | 'KB' | 'MB' | 'GB' | 'TB' | 'PB';
/**
* The number of bytes in each memory unit.
*/
export declare const MEMORY_UNIT_LIMITS: {
readonly [U in MemoryUnit]: number;
};
export declare function formatForDisplay(numBytes: number | undefined, units?: MemoryUnit | undefined): string;
/**
* Given a number of bytes, convert to the most human-readable
* format, (GB, TB, etc).
* If "units" is given, convert to that scale
*/
export declare function convertToLargestUnit(numBytes: number | undefined, units?: MemoryUnit): [number, MemoryUnit];