UNPKG

@lighthouse-web3/sdk

Version:

NPM package and CLI tool to interact with lighthouse protocol

11 lines (10 loc) 363 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function default_1(bytes) { const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; if (bytes === 0) return '0 Byte'; const i = Math.floor(Math.log(+bytes) / Math.log(1024)); return `${Math.round(bytes / Math.pow(1024, i))} ${sizes[i]}`; } exports.default = default_1;