Skip to content

API Reference Overview ​

This section provides detailed documentation for all Node-APK exports.

Core Classes ​

ClassDescription
ApkMain class for parsing APK files
ManifestParsed AndroidManifest.xml information
CertificateSigning certificate with chain support
ResourcesResource table parser for strings, icons, etc.
XmlElementBinary XML element representation

Supporting Classes ​

ClassDescription
ReceiverBroadcast receiver information
LocaleResource locale (language/country)
ResourceIndividual resource value with locale
SourceBinary data source reader
ZipEntryZIP entry handler

Types ​

TypeDescription
ResourceValueUnion type for resource values
LabelOptionsOptions for getLabel() method
IconOptionsOptions for getLauncherIcon() method
IconDensityIcon density values
ChunkTypeBinary chunk type enum
BufferLoaderFunction type for buffer loading

Quick Reference ​

Apk ​

typescript
import { Apk } from "node-apk";

const apk = new Apk(pathOrBuffer);

// Manifest
const manifest = await apk.getManifestInfo();

// Certificate
const certs = await apk.getCertificateInfo();

// Resources
const resources = await apk.getResources();

// Helper methods
const label = await apk.getLabel(options?);
const icon = await apk.getLauncherIcon(options?);

// Extraction
const file = await apk.extract(path);

Manifest ​

typescript
const manifest = await apk.getManifestInfo();

// Properties
manifest.package       // string
manifest.versionCode   // number
manifest.versionName   // string
manifest.applicationLabel  // string | number
manifest.applicationIcon   // number

// Iterables
[...manifest.permissions]  // string[]
[...manifest.receivers]    // Receiver[]

// Raw access
manifest.raw  // XmlElement

Certificate ​

typescript
const certs = await apk.getCertificateInfo();
const cert = certs[0];

// Properties
cert.serial      // string
cert.validFrom   // Date
cert.validUntil  // Date
cert.bytes       // Buffer (DER encoded)

// Maps
cert.issuer.get("CN")   // string | undefined
cert.subject.get("CN")  // string | undefined

// Chain
cert.parent   // Certificate | undefined
cert.chain    // Certificate[]

Resources ​

typescript
const resources = await apk.getResources();

// Resolve resource ID
const resolved = resources.resolve(0x7f040001);
// Resource[] with value and locale

// Access values
resolved[0]?.value   // ResourceValue
resolved[0]?.locale  // Locale | undefined

Module Structure ​

typescript
// Main exports
export { Apk } from "./apk.js";
export { Certificate } from "./certificate.js";
export { Manifest, Receiver } from "./android.js";
export { Locale, Resource, Resources } from "./resources.js";
export { XmlElement } from "./xml.js";
export { Source } from "./source.js";
export { ZipEntry, BufferLoader } from "./zip.js";

// Type exports
export {
  Chunk,
  ChunkType,
  StringPool,
  parseResourceValue,
  type ResourceValue,
} from "./common.js";

// Additional type exports from apk.ts
export type {
  LabelOptions,
  IconOptions,
  IconDensity,
} from "./apk.js";

Released under the MIT License.