修改尺寸

This commit is contained in:
24kycj
2025-04-29 09:50:09 +08:00
parent 293c47506c
commit e7cd850cf9
@@ -46,7 +46,7 @@ export function getExtension(name) {
export function bytesToSize(bytes) { export function bytesToSize(bytes) {
if (bytes === 0) return "0 B"; if (bytes === 0) return "0 B";
var k = 1024, var k = process.platform === 'linux' ? 1000 : 1024,
sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
i = Math.floor(Math.log(bytes) / Math.log(k)); i = Math.floor(Math.log(bytes) / Math.log(k));
return (bytes / Math.pow(k, i)).toPrecision(3) + " " + sizes[i]; return (bytes / Math.pow(k, i)).toPrecision(3) + " " + sizes[i];