Registry / devops / aab-parser

aab-parser

JSON →
library1.0.1jsnpmunverified

aab-parser is a lightweight, asynchronous Android App Bundle (AAB) parser written entirely in TypeScript. It provides functionality to extract key manifest attributes from an AAB file, either as a strongly typed `Manifest` object (a subset of common attributes) or a raw JSON object with more comprehensive data. A key differentiator is its pure Node.js implementation, which means it does not require a Java Development Kit (JDK) installation, unlike many other AAB inspection tools. The current stable version is 1.0.1, released recently after its initial 1.0.0 debut, suggesting an early but active development phase with releases focused on stability and minor enhancements rather than a fixed cadence. It is primarily used for programmatic inspection of AAB metadata in build pipelines or analysis tools.

npm install aab-parser
INSTALL
IMPORT
SIG · AAB-PARSER
A
aab-parser
devopsjavascriptv1.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parseAabManifest
import { parseAabManifest } from 'aab-parser';
const aabParser = require('aab-parser'); aabParser.parseAabManifest(...);
Preferred ESM named import for functions. CommonJS `require` can lead to incorrect type inference or module resolution issues in modern TypeScript/Node.js environments.
parseAabManifestJSON
import { parseAabManifestJSON } from 'aab-parser';
const { parseAabManifestJSON } = require('aab-parser');
ESM named import for accessing the function that returns the full manifest as a plain JSON object.
Manifest
import type { Manifest } from 'aab-parser';
import { Manifest } from 'aab-parser';
Use `import type` for type declarations to ensure they are stripped during compilation, preventing potential runtime errors or bundle size increases.

Demonstrates how to asynchronously parse an Android App Bundle (AAB) file to extract its manifest information using `parseAabManifest`, showing the typed output and handling potential file errors.

import { parseAabManifest, Manifest } from 'aab-parser'; import * as path from 'path'; import { promises as fs } from 'fs'; // Ensure you have an 'example.aab' file in your project root or specify a path. // For testing, you might use a dummy AAB or a real one from a build process. const AAB_FILE_PATH = process.env.AAB_PATH ?? path.join(__dirname, 'example.aab'); async function main() { try { // Create a dummy AAB file for demonstration if it doesn't exist // In a real scenario, this file would be provided. try { await fs.access(AAB_FILE_PATH); } catch (error) { console.warn(`AAB file not found at ${AAB_FILE_PATH}. This example requires an AAB file to run fully.`); console.warn("Creating a placeholder. Please replace with a real AAB for actual parsing."); await fs.writeFile(AAB_FILE_PATH, Buffer.from('PK\x03\x04... (truncated for brevity, a real AAB is much larger)', 'binary')); } console.log(`Parsing AAB manifest from: ${AAB_FILE_PATH}`); const manifest: Manifest = await parseAabManifest(AAB_FILE_PATH); console.log('Parsed AAB Manifest:'); console.log(manifest); // Example of accessing specific fields console.log(`Package Name: ${manifest.packageName}`); console.log(`Version Code: ${manifest.versionCode}`); console.log(`Version Name: ${manifest.versionName}`); } catch (error) { console.error('Error parsing AAB manifest:', error); } } main();
Debug
Known issues
gotchaThe `Manifest` type and the `parseAabManifest` function return a strict subset of AAB manifest attributes. If you require full, untyped manifest data, use `parseAabManifestJSON` instead.
fix
For comprehensive manifest data, invoke `parseAabManifestJSON` which returns a plain object containing all parsed fields from the manifest XML.
affects: >=1.0.0
gotchaAll parsing functions in `aab-parser` are asynchronous and return Promises. Synchronous usage will result in an unhandled promise rejection or a `TypeError` if `await` is not used correctly.
fix
Always use `await` with `parseAabManifest` and `parseAabManifestJSON` within an `async` function, or ensure your environment supports top-level `await`.
affects: >=1.0.0
gotchaThe README example uses CommonJS `require()`. While this might work, in modern TypeScript and Node.js projects, ESM `import` statements are preferred for better type inference, tree-shaking, and consistency. Mixing module systems can lead to build or runtime issues.
fix
Adopt ESM `import { parseAabManifest, Manifest } from 'aab-parser';` for clarity and compatibility in TypeScript projects. Ensure your `tsconfig.json` and `package.json` are configured for ESM (e.g., `"type": "module"`).
affects: >=1.0.0
Errors
Common errors & fixes
SyntaxError: await is only valid in async functions and the top level bodies of modules
Attempting to use `await` outside an `async` function or in a CommonJS module that doesn't support top-level await.
fix
Wrap your code calling `parseAabManifest` or `parseAabManifestJSON` in an `async` function, or ensure your project is configured as an ESM module with Node.js version supporting top-level await (Node.js 14.8+).
Error: ENOENT: no such file or directory, open 'path/to/your/bundle.aab'
The provided path to the AAB file is incorrect, or the file does not exist at that location.
fix
Verify the file path is correct and accessible. Use an absolute path or ensure the relative path is correct from where your script is executed.
TypeError: Cannot read properties of undefined (reading 'packageName')
Attempting to access properties on the result of `parseAabManifest` or `parseAabManifestJSON` when the parsing failed or returned an unexpected value (e.g., due to a corrupt AAB).
fix
Always include error handling (`try...catch`) around AAB parsing calls. Log the error to understand the underlying cause. Ensure the AAB file is valid and not corrupt.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
47 hits · last 30 days
node
39
OpenAI (training)
1
Resources
aab-parser — npm install aab-parser · libregistry