node-android-devices
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

JavaScript library, designed to facilitate communication with Android devices. The library’s interface is Promise-based.

Usage

import { getAdbDevices, execAdbCmdSync, execAdbCmdAsync, execAdbCmd } from 'node-android-devices'

/**
 *  get adb devices list
 */
cosnt list = await getAdbDevices()
// list: [ { sn: '0e2e40071d40xxxx', status: 'device' } ]

/**
 *  use sync method to run adb commamnd, will return a string
 */
const res = execAdbCmdSync('adb devices');
// res: List of devices attached

/**
 *  use async method to run adb commamnd, will return a string
 */
 const res = await execAdbCmdAsync('adb devices');
// res: List of devices attached
// 0e2e40071d40xxxx        device


/**
 *  use exec method to run adb commamnd, will return a ChildProcess
 *  so than you can control the adb process more finely
 */
const adbShell = execAdbCmd('adb shell')
adbShell.stdin.write('ls /data/tmp \n')
adbShell.stdin.write('ls /data/tmp/dir \n')

/**
 *  use spawn method to run adb commamnd, will return a ChildProcess
 *  so than you can control the adb process more finely
 */
const adbShell = spawnAdbCmd('adb', ['shell'])
adbShell.stdin.write('ls /data/tmp \n')
adbShell.stdin.write('ls /data/tmp/dir \n')

Apk

declare function isApkInstalled(
  sn: string,
  apkName: string
): Promise<{
  status: boolean,
  msg: string,
}>;

declare function installApk(
  sn: string,
  apkPath: string
): Promise<{
  status: boolean,
  msg: string,
}>;

declare function uninstallApk(
  sn: string,
  apkName: string
): Promise<{
  status: boolean,
  msg: string,
}>;

Readme

Keywords

Package Sidebar

Install

npm i node-android-devices

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

28 MB

Total Files

10

Last publish

Collaborators

  • xuanguyen