1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

get version from apk/ipa file.

This commit is contained in:
tdzl2003 2016-04-02 20:55:03 +08:00
parent fef8e35884
commit ae628b310a
2 changed files with 19 additions and 1 deletions

View File

@ -4,6 +4,8 @@
import * as path from 'path';
import * as fs from 'fs';
import ApkReader from 'node-apk-parser';
import ipaMetadata from 'ipa-metadata';
var read = require('read');
@ -40,4 +42,18 @@ export function getRNVersion() {
major: match[1] | 0,
minor: match[2] | 0,
};
}
}
export function getApkVersion(fn) {
const reader = ApkReader.readFile(fn);
const manifest = reader.readManifestSync();
return Promise.resolve(manifest.versionName);
}
export function getIPAVersion(fn) {
return new Promise((resolve, reject) => {
ipaMetadata(fn, (err, data) => {
err ? reject(err) : resolve(data);
});
});
}

View File

@ -29,8 +29,10 @@
"dependencies": {
"cli-arguments": "^0.2.1",
"fs-promise": "^0.4.1",
"ipa-metadata": "^1.4.0",
"isomorphic-fetch": "^2.2.1",
"mkdir-recursive": "^0.2.1",
"node-apk-parser": "^0.2.3",
"node-bsdiff": "^0.1.2",
"read": "^1.0.7",
"yauzl": "^2.4.1",