优化接入功能&重构接入文件操作
This commit is contained in:
@ -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];
|
||||
}
|
Reference in New Issue
Block a user