chore: 文件大小限制调整为20MB

This commit is contained in:
thzxx
2026-05-18 17:36:41 +08:00
parent 21d7b2da9f
commit c773a0d8e6
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ const path = require('path');
const fs = require('fs');
const { readFile, stat } = require('fs/promises');
const MAX_FILE_SIZE = 10 * 1024 * 1024; // 10MB
const MAX_FILE_SIZE = 20 * 1024 * 1024; // 20MB
let mainWindow = null;
let activeFilePath = null; // Currently active tab's file path
@@ -156,7 +156,7 @@ async function readFileContent(filePath) {
// 文件大小检查
const stats = await stat(filePath);
if (stats.size > MAX_FILE_SIZE) {
throw new Error(`文件过大(${(stats.size / 1024 / 1024).toFixed(1)} MB),暂不支持超过 10MB 的文件`);
throw new Error(`文件过大(${(stats.size / 1024 / 1024).toFixed(1)} MB),暂不支持超过 20MB 的文件`);
}
let content = await readFile(filePath, 'utf-8');
// 剥离 UTF-8 BOMWindows 某些编辑器会添加)