adb.js 835 B

123456789101112131415161718192021222324
  1. const gfin = require('get-files-in')
  2. const shellExec = require('shell-exec')
  3. module.exports = {
  4. getListOfAPk: () => {
  5. this.apkListToInstall = gfin('./data/apps', matchFiletypes = ["apk"], checkSubDirectories = false)
  6. },
  7. installApk: async () => {
  8. await module.exports.getListOfAPk()
  9. for (let element of this.apkListToInstall) {
  10. if (process.platform === 'win32' || process.platform === 'win64') {
  11. await shellExec('adb install -r ' + element).then(function (result) {
  12. console.log('Installing ' + element + ' - ' + result.stdout);
  13. });
  14. } else {
  15. await shellExec('./adb install -r ' + element).then(function (result) {
  16. console.log('Installing ' + element + ' - ' + result.stdout);
  17. });
  18. }
  19. }
  20. // console.log(chalk.green('Removal Complete'))
  21. },
  22. };