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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mcesystems/adb-kit

v1.0.27

Published

ADB (Android Debug Bridge) toolkit for device management

Readme

@mcesystems/adb-kit

ADB (Android Debug Bridge) toolkit for device management. Provides a TypeScript wrapper around adbkit for Android device operations.

Features

  • Device Operations: Get device properties, install/uninstall apps
  • USB Debugging Detection: Check and wait for USB debugging enabled
  • Port Forwarding: Forward local ports to device services
  • Cross-platform: Works on Windows, macOS, and Linux

Installation

npm install @mcesystems/adb-kit

Requirements

  • Node.js 18+
  • Android device with USB debugging enabled
  • ADB binaries (see Platform Setup)

Platform Setup

Using the Export Script (Recommended for Distribution)

Use the export script to bundle ADB binaries for your application:

# Using npx (after installing the package)
npx export-adb-resources /path/to/your-app/resources/adb-kit

# Or export for all platforms at once
npx export-adb-resources /path/to/your-app/resources/adb-kit --all

# Or run the script directly
npx tsx node_modules/@mcesystems/adb-kit/scripts/export-resources.ts /path/to/your-app/resources

See scripts/README.md for detailed prerequisites and instructions.

Windows & macOS (Development)

Set the AdbBinPath environment variable to the ADB binary location, or ensure adb is in your system PATH.

Linux

Install ADB via your package manager:

sudo apt install adb  # Debian/Ubuntu
sudo dnf install android-tools  # Fedora

Usage

Basic Device Operations

import { AdbDeviceKit } from '@mcesystems/adb-kit';

// Create a device kit for a specific device
const device = new AdbDeviceKit('device-serial-number', 1);

// Get device properties
const [manufacturer, model] = await device.getDeviceProperties(['Manufacturer', 'Model']);
console.log(`Device: ${manufacturer} ${model}`);

// Get all properties
const allProps = await device.getAllDeviceProperties();

// List connected devices
const devices = await device.listDevices();

App Management

const device = new AdbDeviceKit('device-serial-number', 1);

// Install an APK
await device.installApp('/path/to/app.apk');

// Check if app is installed
const isInstalled = await device.isAppInstalled('com.example.app');

// Uninstall an app
await device.uninstallApp('com.example.app');

USB Debugging

const device = new AdbDeviceKit('device-serial-number', 1);

// Check if USB debugging is enabled
const hasDebugging = await device.hasUsbDebugging();

// Wait for USB debugging to be enabled (with timeout)
await device.waitForUsbDebugging(30000); // 30 seconds

Port Forwarding

const device = new AdbDeviceKit('device-serial-number', 1);

// Forward a local port to a device service
const localPort = await device.startPortForward('tcp:8080');
console.log(`Forwarded to local port: ${localPort}`);

Access ADB Client

const device = new AdbDeviceKit('device-serial-number', 1);

// Get the underlying adbkit client for advanced operations
const client = await device.getClient();

// Get the device client for direct device operations
const deviceClient = await device.getDeviceClient();

API Reference

AdbDeviceKit

Constructor:

  • new AdbDeviceKit(deviceId: string, port: number): Create a device kit

Device Info:

  • getDeviceId(): Get the device serial number
  • getPort(): Get the logical port number
  • getDeviceProperties(properties: DeviceProperty[]): Get specific device properties
  • getAllDeviceProperties(): Get all device properties

Device State:

  • hasUsbDebugging(): Check if USB debugging is enabled
  • waitForUsbDebugging(timeout?): Wait for USB debugging

App Management:

  • installApp(apkPath: string): Install an APK
  • uninstallApp(packageName: string): Uninstall an app
  • isAppInstalled(packageName: string): Check if app is installed

Port Forwarding:

  • startPortForward(serviceName: string): Forward to a device service

Advanced:

  • getClient(): Get the adbkit client
  • getDeviceClient(): Get the device client
  • listDevices(): List all connected devices

DeviceProperty

Available device properties:

  • Manufacturer, Name, Model, Brand, Device
  • Android Version, Platform, CPU, CPU.abi2
  • Description, Fingerprint
  • GSM Flexversion, GSM IMEI
  • Locale Language, Locale Region
  • Wifi Channels, Board Platform, Product Board
  • Display ID, Version Incremental, Version SDK
  • Version Codename, Version Release
  • Build Date, Build Type, Build User

Development

# Build the package
npm run build

# Run tests
npm test

# Clean build artifacts
npm run clean

Setting Up ADB for Development

For development, you can either:

  1. Use the export script to download ADB to a local path
  2. Install ADB via Homebrew (brew install android-platform-tools) or your system package manager
  3. Set AdbBinPath environment variable to your ADB installation

License

ISC

ADB Platform Tools are licensed under the Apache License 2.0.