Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

adbkit-apkreader

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adbkit-apkreader - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

11

CHANGELOG.md
# Changelog
## 2.1.0 (2017-03-01)
### Enhancements
* Added `readContent(path)` to read the raw content of any file. Thanks @LegNeato!
* Exposed `usingFileStream(path, action)` that allows you to consume the contents of a file as a Stream. Useful for very large files.
### Fixes
* `readXml(path)` was unable to read any other file than `AndroidManifest.xml` due to an oversight. You can now read any file with it.
## 2.0.0 (2017-01-24)

@@ -4,0 +15,0 @@

14

lib/apkreader.js

@@ -13,6 +13,4 @@ (function() {

ApkReader = (function() {
var MANIFEST;
ApkReader.MANIFEST = 'AndroidManifest.xml';
MANIFEST = 'AndroidManifest.xml';
ApkReader.open = function(apk) {

@@ -74,3 +72,3 @@ return Promise.resolve(new ApkReader(apk));

zipfile.on('entry', entryListener = function(entry) {
if (entry.fileName === MANIFEST) {
if (entry.fileName === file) {
return resolve(Promise.fromCallback(function(callback) {

@@ -99,4 +97,10 @@ return zipfile.openReadStream(entry, callback);

ApkReader.prototype.readContent = function(path) {
return this.usingFile(path, function(content) {
return content;
});
};
ApkReader.prototype.readManifest = function() {
return this.usingFile(MANIFEST, function(content) {
return this.usingFile(ApkReader.MANIFEST, function(content) {
return new ManifestParser(content).parse();

@@ -103,0 +107,0 @@ });

{
"name": "adbkit-apkreader",
"version": "2.0.0",
"version": "2.1.0",
"description": "Extracts information from APK files.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -32,2 +32,6 @@ # adbkit-apkreader

#### ApkReader.MANIFEST
A convenience constant with the value `'AndroidManifest.xml'`. Can use useful with other API methods in certain circumstances.
#### ApkReader.open(file)

@@ -42,2 +46,9 @@

#### reader.readContent(path)
Reads the content of the given file inside the APK.
* **path** The path to the file. For example, giving `'META-INF/MANIFEST.MF'` as the path would read the content of that file.
* Returns: A `Promise` that resolves with a `Buffer` containing the full content of the file.
#### reader.readManifest()

@@ -97,3 +108,3 @@

* **path** The path to the binary XML file inside the APK. For example, giving `AndroidManifest.xml` as the path would parse the manifest (but you'll probably want to use `reader.readManifestSync()` instead).
* **path** The path to the binary XML file inside the APK. For example, giving `'AndroidManifest.xml'` as the path would parse the manifest (but you'll probably want to use `reader.readManifest()` instead).
* Returns: A `Promise` that resolves with a JavaScript `Object` representation of the root node of the XML file. All nodes including the root node have the properties listed below. Rejects on error (e.g. if parsing was unsuccessful).

@@ -117,2 +128,11 @@ - **namespaceURI** The namespace URI or `null` if none.

#### reader.usingFileStream(path, action)
Opens a readable Stream to the given file inside the APK and runs the given action with it. The APK file is kept open while the action runs, allowing you to process the stream. Once the action finishes, the APK will be automatically closed.
* **path** The path to the file. For example, giving `'META-INF/MANIFEST.MF'` as the path would open that file.
* **action(stream)** A function that processes the stream somehow. **MUST** return a `Promise` that resolves when you're done processing the stream. The value that the `Promise` resolves with will also be the value that `usingFileStream()` resolves with.
- **stream** A readable Stream of the file content. You should either consume or end the stream yourself before resolving the action.
* Returns: A `Promise` that resolves with whatever `action` resolves with.
## More information

@@ -119,0 +139,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc