npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ahmed-sarmoum/capacitor-apk-installer

v1.0.1

Published

Check for new versions apks in the downloads folder

Readme

apk-files

Check for new versions apks in the downloads folder

Install

npm install apk-files
npx cap sync

API

listDownloadApks(...)

listDownloadApks(options?: ListApksOptions | undefined) => Promise<ApkListResult>

List APK files found in the Downloads directories

| Param | Type | Description | | ------------- | ----------------------------------------------------------- | ---------------------------- | | options | ListApksOptions | - Optional filtering options |

Returns: Promise<ApkListResult>


listAllApks(...)

listAllApks(options?: ListApksOptions | undefined) => Promise<ApkListResult>

List all APK files on the device (including Downloads and other directories)

| Param | Type | Description | | ------------- | ----------------------------------------------------------- | ---------------------------- | | options | ListApksOptions | - Optional filtering options |

Returns: Promise<ApkListResult>


debugScan()

debugScan() => Promise<DebugScanResult>

Debug scan to check Download directories and their contents

Returns: Promise<DebugScanResult>


scanSpecificPath(...)

scanSpecificPath(options: ScanPathOptions) => Promise<ScanPathResult>

Scan a specific directory path for APK files

| Param | Type | Description | | ------------- | ----------------------------------------------------------- | ---------------------------- | | options | ScanPathOptions | - Path and filtering options |

Returns: Promise<ScanPathResult>


requestAllFilesAccess()

requestAllFilesAccess() => Promise<PermissionResult>

Request "All Files Access" permission (Android 11+)

Returns: Promise<PermissionResult>


checkPermissions()

checkPermissions() => Promise<PermissionsStatus>

Check current permissions status

Returns: Promise<PermissionsStatus>


installApk(...)

installApk(options: InstallApkOptions) => Promise<InstallResult>

Install an APK file

| Param | Type | Description | | ------------- | --------------------------------------------------------------- | ------------------------------------- | | options | InstallApkOptions | - Installation options with file path |

Returns: Promise<InstallResult>


startDownloadListener()

startDownloadListener() => Promise<DownloadListenerResult>

Start listening for download completion events Returns a promise that resolves when listener is active Fires 'downloadComplete' event when downloads finish

Returns: Promise<DownloadListenerResult>


stopDownloadListener()

stopDownloadListener() => Promise<DownloadListenerResult>

Stop listening for download completion events

Returns: Promise<DownloadListenerResult>


downloadApk(...)

downloadApk(options: DownloadApkOptions) => Promise<DownloadResult>

Download an APK file using Android DownloadManager

| Param | Type | Description | | ------------- | ----------------------------------------------------------------- | --------------------------------------------- | | options | DownloadApkOptions | - Download options including URL and filename |

Returns: Promise<DownloadResult>


getDownloadStatus(...)

getDownloadStatus(options: DownloadStatusOptions) => Promise<DownloadStatus>

Get the status of a download

| Param | Type | Description | | ------------- | ----------------------------------------------------------------------- | ---------------------- | | options | DownloadStatusOptions | - Download ID to check |

Returns: Promise<DownloadStatus>


cancelDownload(...)

cancelDownload(options: CancelDownloadOptions) => Promise<CancelDownloadResult>

Cancel an ongoing download

| Param | Type | Description | | ------------- | ----------------------------------------------------------------------- | ----------------------- | | options | CancelDownloadOptions | - Download ID to cancel |

Returns: Promise<CancelDownloadResult>


deleteApk(...)

deleteApk(options: DeleteApkOptions) => Promise<DeleteApkResult>

Delete an APK file from storage

| Param | Type | Description | | ------------- | ------------------------------------------------------------- | --------------------- | | options | DeleteApkOptions | - File path to delete |

Returns: Promise<DeleteApkResult>


startDownloadProgressListener(...)

startDownloadProgressListener(options: DownloadProgressOptions) => Promise<DownloadProgressListenerResult>

Start monitoring download progress for a specific download Fires 'downloadProgress' events with real-time progress updates

| Param | Type | Description | | ------------- | --------------------------------------------------------------------------- | ------------------------ | | options | DownloadProgressOptions | - Download ID to monitor |

Returns: Promise<DownloadProgressListenerResult>


stopDownloadProgressListener()

stopDownloadProgressListener() => Promise<DownloadProgressListenerResult>

Stop monitoring download progress

Returns: Promise<DownloadProgressListenerResult>


addListener('downloadComplete', ...)

addListener(eventName: 'downloadComplete', listenerFunc: (data: DownloadCompleteEvent) => void) => Promise<PluginListenerHandle>

Add a listener for download completion events

| Param | Type | Description | | ------------------ | ------------------------------------------------------------------------------------------ | --------------------------------- | | eventName | 'downloadComplete' | - Event name ('downloadComplete') | | listenerFunc | (data: DownloadCompleteEvent) => void | - Callback function |

Returns: Promise<PluginListenerHandle>


addListener('installationStarted', ...)

addListener(eventName: 'installationStarted', listenerFunc: (data: InstallationEvent) => void) => Promise<PluginListenerHandle>

Add a listener for installation events

| Param | Type | Description | | ------------------ | ---------------------------------------------------------------------------------- | ------------------------------------ | | eventName | 'installationStarted' | - Event name ('installationStarted') | | listenerFunc | (data: InstallationEvent) => void | - Callback function |

Returns: Promise<PluginListenerHandle>


addListener('downloadProgress', ...)

addListener(eventName: 'downloadProgress', listenerFunc: (data: DownloadProgressEvent) => void) => Promise<PluginListenerHandle>

Add a listener for download progress events

| Param | Type | Description | | ------------------ | ------------------------------------------------------------------------------------------ | --------------------------------- | | eventName | 'downloadProgress' | - Event name ('downloadProgress') | | listenerFunc | (data: DownloadProgressEvent) => void | - Callback function |

Returns: Promise<PluginListenerHandle>


removeAllListeners()

removeAllListeners() => Promise<void>

Remove all listeners for this plugin


Interfaces

ApkListResult

| Prop | Type | Description | | ---------------- | ---------------------- | ------------------------------------------ | | files | ApkFile[] | Array of APK files found | | count | number | Total count of files found | | filteredBy | string | Package name used for filtering (if any) | | onlyLatest | boolean | Whether only latest versions were returned |

ApkFile

| Prop | Type | Description | | -------------------- | ----------------------------- | -------------------------------------------------------------------------------------- | | name | string | File name | | uri | string | Content URI of the file | | path | string | Absolute file path (may not be available on all Android versions) | | size | number | File size in bytes | | lastModified | number | Last modified timestamp (milliseconds since epoch) | | source | string | Source where the file was found (e.g., "Downloads", "MediaStore_Downloads", "Storage") | | appId | string | Package name / application ID | | apkVersionName | string | Version name (e.g., "1.0.0") | | apkVersionCode | string | number | Version code (numeric version) |

ListApksOptions

| Prop | Type | Description | | ---------------- | -------------------- | --------------------------------------------------------------------------- | | appId | string | Filter results by package name (appId) | | onlyLatest | boolean | If true, only returns the latest version of each app (based on versionCode) |

DebugScanResult

| Prop | Type | Description | | -------------------------- | ---------------------------- | ---------------------------------------------- | | downloadDirectories | DirectoryInfo[] | Information about scanned download directories | | hasStoragePermission | boolean | Whether storage permission is granted | | externalStorageState | string | External storage state |

DirectoryInfo

| Prop | Type | Description | | ----------------- | ----------------------- | ---------------------------------- | | path | string | Directory path | | exists | boolean | Whether directory exists | | isDirectory | boolean | Whether path is a directory | | canRead | boolean | Whether directory is readable | | totalFiles | number | Total number of files in directory | | apkCount | number | Number of APK files found | | files | FileInfo[] | List of files in directory | | error | string | Error message if scan failed |

FileInfo

| Prop | Type | Description | | -------------------- | -------------------- | ----------------------------------- | | name | string | File name | | isFile | boolean | Whether it's a file (not directory) | | size | number | File size in bytes | | canRead | boolean | Whether file is readable | | isAPK | boolean | Whether file is an APK | | apkVersionName | string | APK version name (if available) | | apkVersionCode | number | APK version code (if available) | | appId | string | Package name (if available) |

ScanPathResult

| Prop | Type | Description | | --------------------- | -------------------- | ------------------------------- | | scannedPath | string | Path that was scanned | | pathExists | boolean | Whether the path exists | | pathIsDirectory | boolean | Whether the path is a directory | | pathCanRead | boolean | Whether the path is readable |

ScanPathOptions

| Prop | Type | Description | | ---------------- | -------------------- | ---------------------------------------------------- | | path | string | Directory path to scan | | appId | string | Filter results by package name | | onlyLatest | boolean | If true, only returns the latest version of each app |

PermissionResult

| Prop | Type | Description | | ------------- | -------------------- | ----------------------------- | | granted | boolean | Whether permission is granted | | message | string | Status message |

PermissionsStatus

| Prop | Type | Description | | ------------------------------- | -------------------- | --------------------------------------------------- | | hasStoragePermission | boolean | Whether storage permission is granted | | hasAllFilesAccess | boolean | Whether "All Files Access" is granted (Android 11+) | | canRequestInstallPackages | boolean | Whether app can request package installs | | sdkVersion | number | Android SDK version | | readExternalStorage | boolean | Whether READ_EXTERNAL_STORAGE is granted |

InstallResult

| Prop | Type | Description | | ------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | | status | string | Installation status "installation_started" - Intent launched successfully "permission_required" - Need to enable install permission | | message | string | Status message | | apkPath | string | Path of the APK concerned (only when permission_required) |

InstallApkOptions

| Prop | Type | Description | | ---------- | ------------------- | ----------------------------- | | path | string | Absolute path to the APK file |

DownloadListenerResult

| Prop | Type | Description | | ---------------- | -------------------- | -------------------------------------------- | | listening | boolean | Whether listener is active | | message | string | Status message | | sdkVersion | number | Android SDK version (when starting listener) |

DownloadResult

| Prop | Type | Description | | ---------------- | ------------------- | --------------------------------------------- | | downloadId | number | Download ID assigned by DownloadManager | | fileName | string | Filename being downloaded | | url | string | URL being downloaded | | message | string | Status message (deprecated, use other fields) |

DownloadApkOptions

| Prop | Type | Description | | ----------------- | ------------------- | ------------------------------------------ | | path | string | URL of the APK file to download | | title | string | Title shown in download notification | | description | string | Description shown in download notification |

DownloadStatus

| Prop | Type | Description | | --------------------- | ------------------- | -------------------------------------------------------------------------------- | | downloadId | number | Download ID | | status | string | Status string: "PENDING", "RUNNING", "PAUSED", "SUCCESSFUL", "FAILED", "UNKNOWN" | | statusCode | number | Status code (numeric) | | reason | number | Reason code (for failures/pauses) | | bytesDownloaded | number | Bytes downloaded so far | | bytesTotal | number | Total bytes to download | | uri | string | File URI (available when complete) | | title | string | Download title | | progress | number | Download progress percentage (0-100) |

DownloadStatusOptions

| Prop | Type | Description | | ---------------- | ------------------- | -------------------- | | downloadId | number | Download ID to check |

CancelDownloadResult

| Prop | Type | Description | | ---------------- | -------------------- | ------------------------------ | | removed | boolean | Whether download was removed | | downloadId | number | Download ID that was cancelled |

CancelDownloadOptions

| Prop | Type | Description | | ---------------- | ------------------- | --------------------- | | downloadId | number | Download ID to cancel |

DeleteApkResult

| Prop | Type | Description | | ------------- | -------------------- | ------------------------------------- | | deleted | boolean | Whether file was deleted successfully | | path | string | Path that was deleted |

DeleteApkOptions

| Prop | Type | Description | | ---------- | ------------------- | --------------------------------------- | | path | string | Absolute path to the APK file to delete |

DownloadProgressListenerResult

| Prop | Type | Description | | ---------------- | -------------------- | ----------------------------------- | | listening | boolean | Whether progress listener is active | | downloadId | number | Download ID being monitored | | message | string | Status message |

DownloadProgressOptions

| Prop | Type | Description | | ---------------- | ------------------- | ---------------------- | | downloadId | number | Download ID to monitor |

PluginListenerHandle

| Prop | Type | | ------------ | ----------------------------------------- | | remove | () => Promise<void> |

DownloadCompleteEvent

| Prop | Type | Description | | ---------------- | -------------------------------- | ------------------------------------------------------------ | | event | 'download_complete' | Event type | | downloadId | number | Download ID that completed | | timestamp | number | Timestamp when download completed (milliseconds since epoch) | | apkPath | string | APK file path (if available) |

InstallationEvent

Event fired when installation is triggered (after permission grant or directly)

| Prop | Type | Description | | ------------- | ----------------------------------------------------------- | ---------------------------------------------------------- | | event | 'installation_started' | 'installation_error' | Event type: 'installation_started' or 'installation_error' | | status | 'error' | 'installation_started' | Installation status | | message | string | Status message | | path | string | Path of the APK being installed (optional) |

DownloadProgressEvent

Event fired during download progress Updates every ~500ms while download is active

| Prop | Type | Description | | --------------------- | ------------------- | ------------------------------------------------------------------------------- | | downloadId | number | Download ID being monitored | | bytesDownloaded | number | Bytes downloaded so far | | bytesTotal | number | Total bytes to download | | progress | number | Download progress percentage (0-100) | | status | string | Current download status: "PENDING", "RUNNING", "PAUSED", "SUCCESSFUL", "FAILED" | | statusCode | number | Status code (numeric) | | error | string | Error message (only present if status is "FAILED") |