Files
todo-frontend/node_modules/licia/fileSize.js
Agent d12eea7693
Some checks failed
continuous-integration/drone/push Build is failing
fix: 微信登录补充保存username和role
2026-04-04 07:35:21 +00:00

10 lines
302 B
JavaScript

exports = function(bytes) {
if (bytes <= 0) return '0';
var suffixIdx = Math.floor(Math.log(bytes) / Math.log(1024));
var val = bytes / Math.pow(2, suffixIdx * 10);
return +val.toFixed(2) + suffixList[suffixIdx];
};
var suffixList = ['', 'K', 'M', 'G', 'T'];
module.exports = exports;