优化接入功能&重构接入文件操作

This commit is contained in:
dushixiang
2021-02-02 23:06:50 +08:00
parent 29fb520e48
commit 32b31eba1a
13 changed files with 697 additions and 569 deletions

View File

@ -209,4 +209,16 @@ export function exitFull() {
wScript.SendKeys("{F11}");
}
}
}
export function renderSize(value) {
if (null == value || value === '' || value === 0) {
return "0 Bytes";
}
const unitArr = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
let srcSize = parseFloat(value);
let index = Math.floor(Math.log(srcSize) / Math.log(1024));
let size = srcSize / Math.pow(1024, index);
size = size.toFixed(2);
return size + unitArr[index];
}