更新
This commit is contained in:
@@ -3,8 +3,9 @@
|
||||
* 处理不同操作系统的文件大小差异
|
||||
*/
|
||||
|
||||
// 检测操作系统
|
||||
// 检测操作系统(网页端无 process.platform,返回 'web')
|
||||
export function getOS() {
|
||||
if (typeof process === 'undefined' || process.platform === undefined) return 'web'
|
||||
const platform = process.platform
|
||||
if (platform === 'win32') return 'windows'
|
||||
if (platform === 'darwin') return 'mac'
|
||||
@@ -20,7 +21,8 @@ export function getBaseSize() {
|
||||
const baseSizes = {
|
||||
windows: 1024, // Windows 使用 1024 进制 (二进制)
|
||||
mac: 1024, // macOS 使用 1024 进制 (十进制)
|
||||
linux: 1024 // Linux 使用 1024 进制 (十进制,遵循 SI 标准)
|
||||
linux: 1024, // Linux 使用 1024 进制 (十进制,遵循 SI 标准)
|
||||
web: 1024 // 网页端固定 1024
|
||||
}
|
||||
|
||||
return baseSizes[os] || 1024
|
||||
|
||||
Reference in New Issue
Block a user