Closed pojelo199 closed 2 months ago
抱歉,我这边没有复现bug,但我调整了相关代码。 由于问题出在上游库,我只尝试改变了get-folder-size库中函数的返回值类型,让其总返回BigInt类型,不知道能不能解决问题,还请更新后测试一下。
抱歉,我这边没有复现bug,但我调整了相关代码。 由于问题出在上游库,我只尝试改变了get-folder-size库中函数的返回值类型,让其总返回BigInt类型,不知道能不能解决问题,还请更新后测试一下。
您好,更新之后问题已解决,感谢您的快速回复
感谢测试
软件版本
1.0.1
问题描述
经app.asar解包之后,查阅index.js代码发现,在代码的31~34行有如下操作: if (!foundInos.has(stats.ino)) { foundInos.add(stats.ino); folderSize += stats.size; }
而51~64行: if (!options.bigint) { if (folderSize > BigInt(Number.MAX_SAFE_INTEGER)) { const error = new RangeError( "The folder size is too large to return as a Number. You can instruct this package to return a BigInt instead.", ); if (returnType.strict) { throw error; } errors.push(error); folderSize = Number.MAX_SAFE_INTEGER; } else { folderSize = Number(folderSize); } } 存在folderSize被转换为Number类型后继续与BigInt类型的stats.size运算的可能,导致错误的产生。
问题日志
日志如下: [2024-08-26 21:12:30.584] [error] Error in organizeGameData: TypeError: Cannot mix BigInt and other types, use explicit conversions at processItem (file:///D:/applications/vnite/resources/app.asar/node_modules/get-folder-size/index.js:33:24) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Promise.all (index 0) at async processItem (file:///D:/applications/vnite/resources/app.asar/node_modules/get-folder-size/index.js:43:4) at async Promise.all (index 12) at async processItem (file:///D:/applications/vnite/resources/app.asar/node_modules/get-folder-size/index.js:43:4) at async Promise.all (index 26) at async processItem (file:///D:/applications/vnite/resources/app.asar/node_modules/get-folder-size/index.js:43:4) at async core (file:///D:/applications/vnite/resources/app.asar/node_modules/get-folder-size/index.js:20:2) at async getFolderSize (file:///D:/applications/vnite/resources/app.asar/node_modules/get-folder-size/index.js:4:9) [2024-08-26 21:12:30.585] [error] Unhandled rejection TypeError: Cannot mix BigInt and other types, use explicit conversions at processItem (file:///D:/applications/vnite/resources/app.asar/node_modules/get-folder-size/index.js:33:24) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Promise.all (index 0) at async processItem (file:///D:/applications/vnite/resources/app.asar/node_modules/get-folder-size/index.js:43:4) at async Promise.all (index 12) at async processItem (file:///D:/applications/vnite/resources/app.asar/node_modules/get-folder-size/index.js:43:4) at async Promise.all (index 26) at async processItem (file:///D:/applications/vnite/resources/app.asar/node_modules/get-folder-size/index.js:43:4) at async core (file:///D:/applications/vnite/resources/app.asar/node_modules/get-folder-size/index.js:20:2) at async getFolderSize (file:///D:/applications/vnite/resources/app.asar/node_modules/get-folder-size/index.js:4:9)
问题截图
错误截图如下: