Socket
Book a DemoInstallSign in
Socket

simple-adb

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-adb

Module to easily use ADB with node.js

1.7.9
latest
Source
npmnpm
Version published
Weekly downloads
10
900%
Maintainers
1
Weekly downloads
 
Created
Source

SimpleADB

This is a module to execute simple commands with ADB

Build Status

Basic Usage


var SimpleADB = require('simple-adb').SimpleADB;

var sadb = new SimpleADB();

sadb.connect('192.168.1.5')
    .then(function () {
       console.log('connected');
    })
    .catch(function (err) {
       console.log(err);
    });

Here is an example on how to reboot your android device via ADB


var SimpleADB = require('simple-adb').SimpleADB;

var sadb = new SimpleADB();

sadb.connect('192.168.1.5')
     .then(function () {
        sadb.reboot()
            .then(function () {
                console.log('rebooted');
            });
     })
     .catch(function (err) {
        console.log(err);
     });


The SimpleADB Class

var SimpleADB = require('simple-adb').SimpleADB;

var sadb = new SimpleADB({
        logger: null, // optional - if populated, should be a Bunyan instance.
        logLevel: 'error' | 'warn' | 'info', //optional, ignored if `logger` is populated
        path: '/path/to/adb' //optional, if you have a custom path, this may be required
    });

SimpleADB Methods

N.B. All methods return a Promise.

var SimpleADB = require('simple-adb').SimpleADB;

var sadb = new SimpleADB();

// to connect to a device (only one device can be connected to at a time)
sadb.connect(ipAddress);

// to disconnect device
sadb.disconnect();

// to reboot device
sadb.reboot();

// to shutdown device
sadb.shutdown();

// to force stop an application
sadb.forceStopApp(packageName);

// to start an application
sadb.startApp(packageName, launchName);

// to restart an application
sadb.restartApp(packageName. launchName);

// to perform any other task with adb
sadb.execAdbCommand(args); //args in an array of augements

// to perform any other shell task with adb
sadb.execAdbShellCommand(args); //args in an array of augements

// copy a file to the android device
sadb.push(fromPath, toPath);

// copy a file from the android device
sadb.pull(toPath, fromPath);

sadb.captureScreenshot(pathToSaveScreenshot); // path is optional, will store to home directory if no path given

Tests

Coming soon

Contribute

Please only edit the contents of the src directory as on publish this will be compiled into the build directory.

FAQs

Package last updated on 30 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.