chenquincy / app-info-parser

A javascript parser for parsing .ipa or .apk files. IPA/APK文件 js 解析器
MIT License
492 stars 116 forks source link

When parser some ipa error,app-info-parser can not catch error #87

Closed MrPans closed 1 year ago

MrPans commented 1 year ago

描述 bug When parser some ipa error,app-info-parser can not catch error

复现

  1. 下载下面提供的 ipa,放到下面代码的目录中,使用下面的代码进行解析

代码如下:

const fs = require('fs');
const path = require('path');
const AppInfoParser = require('app-info-parser')

const folderPath = '~/Downloads/ipa-list'; // 文件夹路径
const ipaFiles = fs.readdirSync(folderPath).filter(file => file.endsWith('.ipa')); // 获取所有的 ipa 文件

const ipaInfoList = ipaFiles.map(ipaFile => {
    const ipaPath = path.join(folderPath, ipaFile);
    const parser = new AppInfoParser(ipaPath);
    return parser.parse().then(result => {
        return {
            name: result.CFBundleDisplayName,
            version: result.CFBundleShortVersionString,
            osVersion: result.MinimumOSVersion,
            path: ipaFile
        };
    }).catch(err => {
        console.log(`解析 ${ipaPath} 时出错:${err}`);
        return null; // 返回 null 表示解析失败
    });
});

Promise.all(ipaInfoList).then(results => {
    const validResults = results.filter(result => result !== null); // 过滤掉解析失败的结果
    console.log(JSON.stringify(validResults, null, 2)); // 输出 JSON
}).catch(err => {
    console.log('err ----> ', err);
});

预期表现 应该是正常解析,或者出错了可以被 handle

请填写您的Node或浏览器版本:

请提供测试用的安装包下载链接: - 点击下载有问题的 ipa

chenquincy commented 1 year ago

@MrPans 给的资源包链接无法打开

MrPans commented 1 year ago

更新链接:http://minicola.asuscomm.com:5000/sharing/PawASCaax

@MrPans 给的资源包链接无法打开

chenquincy commented 1 year ago

@MrPans 还是不行,要不给个云盘之类的。我上 github 不定时,临时链接可能会失效。

chenquincy commented 1 year ago

长时间无响应,先关闭 issue,有需要再 reopen 一下