UNPKG

@naturalcycles/nodejs-lib

Version:
24 lines 615 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function mb(b) { return Math.round(b / (1024 * 1024)); } exports.mb = mb; function kb(b) { return Math.round(b / 1024); } exports.kb = kb; /** * Byte size to Human byte size string */ function hb(b = 0) { if (b < 800) return `${Math.round(b)} byte(s)`; if (b < 800 * 1024) return `${Math.round(b / 1024)} Kb`; if (b < 800 * 1024 * 1024) return `${Math.round(b / 1024 / 1024)} Mb`; return `${Math.round(b / 1024 / 1024 / 1024)} Gb`; } exports.hb = hb; //# sourceMappingURL=size.util.js.map