@seayoo-web/app-info 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # app-info
2
+
3
+ 读取 `.apk` `.ipa` `.app` 的应用元信息
4
+
5
+ ## 读取 apk 文件
6
+
7
+ ```ts
8
+ import { parseApk } from "@seayoo-web/app-info";
9
+
10
+ // file 类型 Uint8Array | ArrayBuffer | Blob;
11
+ const apkInfo = await parseApk(file, {
12
+ // 可选项,是否忽略查找图标,设置为 true 可以节约解析时间
13
+ ignoreIcon: false,
14
+ });
15
+ if (apkInfo instanceof Error) {
16
+ console.log("apk parse error", apkInfo.message);
17
+ } else {
18
+ console.log(apkInfo);
19
+ /**
20
+ {
21
+ "package": "...",
22
+ "versionCode": 9999,
23
+ "versionName": "9999.0.0",
24
+ "icon": "...",
25
+ "manifest": {...}
26
+ */
27
+ }
28
+ ```
29
+
30
+ ## 读取 ipa 文件
31
+
32
+ ```ts
33
+ import { parseIpa } from "@seayoo-web/app-info";
34
+
35
+ const ipaInfo = await parseIpa(file, {
36
+ /** 可选项,是否忽略查找图标 */
37
+ ignoreIcon: false,
38
+ /**
39
+ * 可选项,查找更多模块的 plist 信息,传入模块名称,比如 "ComboSDKSentry"
40
+ */
41
+ frameworks: ["ComboSDKSentry"];
42
+ /**
43
+ * 可选项,读取更多文件信息,比如 "ComboSDK.json"
44
+ */
45
+ files: ["ComboSDK.json"];
46
+ });
47
+ if (ipaInfo instanceof Error) {
48
+ console.log("ipa parse error", ipaInfo.message);
49
+ } else {
50
+ console.log(ipaInfo);
51
+ /**
52
+ {
53
+ "package": "...",
54
+ "versionCode": 9999,
55
+ "versionName": "9999.0.0",
56
+ "icon": "...",
57
+ "plist": {...},
58
+ "frameworks": {
59
+ "ComboSDKSentry": {...}
60
+ },
61
+ "files": {
62
+ "ComboSDK.json": <ArrayBuffer>
63
+ }
64
+ }
65
+ */
66
+ }
67
+ ```
68
+
69
+ ## 读取鸿蒙 app 文件
70
+
71
+ ```ts
72
+ import { parseHosApp } from "@seayoo-web/app-info";
73
+
74
+ const hosAppInfo = await parseHosApp(file, {
75
+ /** 可选项,是否忽略查找图标 */
76
+ ignoreIcon: false,
77
+ });
78
+
79
+ if (hosAppInfo instanceof Error) {
80
+ console.log("hos app parse error", hosAppInfo.message);
81
+ } else {
82
+ console.log(hosAppInfo);
83
+ /**
84
+ {
85
+ "package": "...",
86
+ "versionCode": 9999,
87
+ "versionName": "9999.0.0",
88
+ "icon": "...",
89
+ "summary": {...},
90
+ "packages": [...]
91
+ }
92
+ */
93
+ }
94
+ ```