function fileSize(size) {
var string;
if (size >= 1024 * 1024 * 1024 * 1024 / 10) {
size = size / (1024 * 1024 * 1024 * 1024 / 10);
string = "TB";
} else if (size >= 1024 * 1024 * 1024 / 10) {
size = size / (1024 * 1024 * 1024 / 10);
string = "GB";
} else if (size >= 1024 * 1024 / 10) {
size = size / (1024 * 1024 / 10);
string = "MB";
} else if (size >= 1024 / 10) {
size = size / (1024 / 10);
string = "KB";
} else {
size = size * 10;
string = "b";
}
return (Math.round(size) / 10) + string;
};
字节转换为多少mb,kb
最新推荐文章于 2023-11-30 16:51:56 发布