44

Parse APK/IPA file information by js

 5 years ago
source link: https://www.tuicool.com/articles/JVNbMjm
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

app-info-parser

app-info-parser is a parser for parsing .ipa or .apk files. It will return the infomation with json from AndroidManifest.xml or Info.plist .

Support

  • Node :white_check_mark:

  • Browser

    qIfYJnM.png!webvY7Jzia.png!webjMZfqqJ.png!webUzeu2aY.png!webmuYzMbZ.png!web latest :white_check_mark: latest :white_check_mark: latest :white_check_mark: latest :white_check_mark: :x:

Installation

npm install app-info-parser
# or yarn
yarn add app-info-parser

Getting started

NPM Use

const AppInfoParser = require('app-info-parser')
const parser = new AppInfoParser('../packages/test.apk') // or xxx.ipa
parser.parse().then(result => {
  console.log('app info ----> ', result)
  console.log('icon base64 ----> ', result.icon)
}).catch(err => {
  console.log('err ----> ', err)
})

Basic Use

<input type="file" name="file" id="file" onchange="fileSelect()">
<script src="/dist/app-info-parser.js"></script>
<script>
function fileSelect () {
  const files = document.getElementById('file').files
  const parser = new AppInfoParser(files[0])
  parser.parse().then(result => {
    console.log('app info ----> ', result)
    console.log('icon base64 ----> ', result.icon)
  }).catch(err => {
    console.log('err ----> ', err)
  })
}
</script>

Demand loading

You can use demand loading, when you only need one parser.

ApkParser

const ApkParser = require('app-info-parser/src/apk')
const parser = new ApkParser('../packages/test.apk')
parser.parse().then(result => {
  console.log('app info ----> ', result)
  console.log('icon base64 ----> ', result.icon)
}).catch(err => {
  console.log('err ----> ', err)
})

IpaParser

const IpaParser = require('app-info-parser/src/ipa')
const parser = new IpaParser('../packages/test.ipa')
parser.parse().then(result => {
  console.log('app info ----> ', result)
  console.log('icon base64 ----> ', result.icon)
}).catch(err => {
  console.log('err ----> ', err)
})

API Referrer

AppInfoParser | ApkParser | IpaParser

  • constructor(file)
    • file Blob or File in browser, Path in Node
  • parse: () => Promise<Object> A function return a promise, which resolving the parse result

License

MIT

Resources


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK