https://github.com/dwaan/nodejs-adb-wrapper
Wrapper for Android Debug Bridge commands
https://github.com/dwaan/nodejs-adb-wrapper
adb node-module nodejs
Last synced: 3 months ago
JSON representation
Wrapper for Android Debug Bridge commands
- Host: GitHub
- URL: https://github.com/dwaan/nodejs-adb-wrapper
- Owner: dwaan
- License: mit
- Created: 2020-03-10T08:30:03.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-18T22:27:07.000Z (almost 2 years ago)
- Last Synced: 2025-09-05T02:44:04.470Z (9 months ago)
- Topics: adb, node-module, nodejs
- Language: JavaScript
- Homepage:
- Size: 179 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Node.JS Android Bridge wrapper
A Node.JS module to connect Android devices using ADB. Example:
## Installation
````bash
npm install nodejs-adb-wrapper --save # use the library
````
## Example
Check and run [test.js](./test.js) for complete examples
## Options
* **ip** - The device IP (mandatory)
* *config*: JSON object, contains:
* *path* - Path for adb binary (eq: '/usr/bin/' ), default: ''
* *interval* - Requests interval in milliseconds, default: 1000
* *timeout* - Request timeout in milliseconds, default: 1000
* *playbackDelayOff* - Playback delay before it considered there's no media playing, default: 10000
* *retryPowerOn* - How many retry before power on request considered failure, default: 10
* *keycodePowerOn* - Keycode to power on device, default: 'KEYCODE_POWER'
* *keycodePowerOff* - Keycode to power on device, default: 'KEYCODE_POWER'
## Methods
### sleep(ms)
Async helper for waiting in ms miliseconds
### checkTail()
Check if Android device have `tail` command.
**return**
*boolean*
### adbShell(params)
Wrapper to run ADB command
**parameters**
Available parameters:
* **params**: string - the adb command, eg: `dumpsys`
**return**
{ result, message }
* **result**: *boolean* - return true if the command succeded
* **message**: *string* - contain stdout/stderr output
### osShell(params, [id])
Wrapper to run shell command
**parameters**
Available parameters:
* **params**: string - the shell command, eg: `dumpsys`
* *id*: string - process id
**return**
{ result, message }
* **result**: *boolean* - return true if the command succeded
* **message**: *string* - contain stdout/stderr output