M
Size: a a a
M
TS
M
A
return rate > 0
? `${size}${markers[rate]}b`
: `${size}${markers[rate]}`
;
return `${size}${markers[rate]}${rate > 0 : 'b' : ''}`;
const SIZE_UNITS = ['', ' Kb', ' Mb', ' Gb', ' Tb', ' Pb', ' Eb', ' Zb', ' Yb'];
const bytesToSize = bytes => {
if (bytes === 0) return '0';
const exp = Math.floor(Math.log(bytes) / Math.log(1000));
const size = bytes / 1000 ** exp;
const short = Math.round(size, 2);
const unit = SIZE_UNITS[exp];
return short + unit;
};
TS
M
A
return rate > 0
? `${size}${markers[rate]}b`
: `${size}${markers[rate]}`
;
return `${size}${markers[rate]}${rate > 0 : 'b' : ''}`;
const SIZE_UNITS = ['', ' Kb', ' Mb', ' Gb', ' Tb', ' Pb', ' Eb', ' Zb', ' Yb'];
const bytesToSize = bytes => {
if (bytes === 0) return '0';
const exp = Math.floor(Math.log(bytes) / Math.log(1000));
const size = bytes / 1000 ** exp;
const short = Math.round(size, 2);
const unit = SIZE_UNITS[exp];
return short + unit;
};
M
TS
M
TS
A
const bytesToSize = bytes => { ... }
AS
const bytesToSize = bytes => { ... }
KR