0.1.2 • Published 11 months ago

@dderevjanik/termux-api v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Termux API

A wrapper for Termux API in Node.js. This library allows you to interact with your Android device from Node.js using termux-api. This library is a work in progress and not all termux-api commands are implemented.

overview

Usage

Install library npm i termux-api in your Termux instance.

Naming convention follows termux-api commands. For example, termux-battery-status becomes batteryStatus.

import { torch } from "./termux-api";

await torch("on");
await toch("off");

Termux API Progress

  • termux-battery-status (batteryStatus) (wiki) (source)
  • termux-brightness (brightness) (wiki) (source)
  • termux-call-log (callLog) (wiki) (source)
  • termux-camera-info (cameraInfo) (wiki) (source)
  • termux-camera-photo (cameraPhoto) (wiki) (source)
  • termux-clipboard-get (clipboardGet) (wiki) (source)
  • termux-clipboard-set (clipboardSet) (wiki) (source)
  • termux-contact-list (contactList) (wiki) (source)
  • termux-dialog (dialog) (wiki) (source)
  • termux-download (download) (wiki) (source)
  • termux-fingerprint (fingerprint) (wiki) (source)
  • termux-infrared-frequencies (infraredFrequencies) (wiki) (source)
  • termux-infrared-transmit (infraredTransmit) (wiki) (source)
  • termux-job-scheduler (jobScheduler) (wiki) (source)
  • termux-keystore (keystore) (wiki) (source)
  • termux-location (location) (wiki) (source)
  • termux-media-player (mediaPlayer) (wiki) (source)
  • termux-media-scan (mediaScan) (wiki) (source)
  • termux-microphone-record (microphoneRecord) (wiki) (source)
  • termux-nfc (nfc) (wiki) (source)
  • termux-notification-channel (notificationChannel) (wiki) (source)
  • termux-notification-list (notificationList) (wiki) (source)
  • termux-notification-remove (notificationRemove) (wiki) (source)
  • termux-notification (notification) (wiki) (source)
  • termux-sensor (sensor) (wiki) (source)
  • termux-share (share) (wiki) (source)
  • termux-sms-inbox (smsInbox) (wiki) (source)
  • termux-sms-list (smsList) (wiki) (source)
  • termux-sms-send (smsSend) (wiki) (source)
  • termux-speech-to-text (speechToText) (wiki) (source)
  • termux-storage-get (storageGet) (wiki) (source)
  • termux-telephony-call (telephonyCall) (wiki) (source)
  • termux-telephony-cellinfo (telephonyCellInfo) (wiki) (source)
  • termux-telephony-deviceinfo (telephonyDeviceInfo) (wiki) (source)
  • termux-toast (toast) (wiki) (source)
  • termux-torch (torch) (wiki) (source)
  • termux-tts-engines (ttsEngines) (wiki) (source)
  • termux-tts-speak (ttsSpeak) (wiki) (source)
  • termux-usb (usb) (wiki) (source)
  • termux-vibrate (vibrate) (wiki) (source)
  • termux-volume (volume) (wiki) (source)
  • termux-wallpaper (wallpaper) (wiki) (source)
  • termux-wifi-connectioninfo (wifiConnectionInfo) (wiki) (source)
  • termux-wifi-enable (wifiEnable) (wiki) (source)
  • termux-wifi-scaninfo (wifiScanInfo) (wiki) (source)

Development

On remote machine

ssh user@remote_machine_ip
sudo apt update
sudo apt install openssh-server
ssh-keygen -t rsa -b 2048 -m PEM -f ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys

On local machine

scp user@remote_machine_ip:~/.ssh/id_rsa ~/path_to_save/id_rsa.pem
chmod 400 ~/path_to_save/id_rsa.pem
ssh -i ~/path_to_save/id_rsa.pem user@remote_machine_ip

TODO

  • Timeout for exec (sometimes termux-api hangs)
  • Use zod for validation (e.g. Contact, Location, Message, etc.)
  • Add jsdoc to termux-api functions
    • Include requirements (permission, min. android version, hardware)
0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago