# termux-api-wrapper

> Node module for Termux-API

Latest version **1.1.4** (published 2021-06-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install termux-api-wrapper
pnpm add termux-api-wrapper
yarn add termux-api-wrapper
bun add termux-api-wrapper
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2021-06-17 |
| First published | 2021-06-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 32.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | LKD70 |
| Maintainers | lkd70 |
| Keywords | termux, api, android, wrapper, node |

## Links

- npm: https://www.npmjs.com/package/termux-api-wrapper
- Repository: https://github.com/lkd70/termux
- Homepage: https://github.com/lkd70/termux#readme
- Issues: https://github.com/lkd70/termux/issues
- npm.io page: https://npm.io/package/termux-api-wrapper

## Dependencies (5)

- [glob](https://npm.io/package/glob.md) ^7.1.7
- [dargs](https://npm.io/package/dargs.md) ^8.0.0
- [debug](https://npm.io/package/debug.md) ^4.3.1
- [execa](https://npm.io/package/execa.md) ^5.1.1
- [has-termux-api](https://npm.io/package/has-termux-api.md) ^1.0.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.1.4 (latest) — 2021-06-17
- 1.1.3 — 2021-06-17
- 1.1.2 — 2021-06-17

## README

# termux-api-wrapper

[![NPM Version](https://img.shields.io/npm/v/termux-api-wrapper.svg)](https://www.npmjs.com/package/termux-api-wrapper)
[![Dependency Status](https://david-dm.org/lkd70/termux.png)](https://david-dm.org/lkd70/termux)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

> Comprehensive Node.js module for [Termux-API](https://wiki.termux.com/wiki/Termux:API)

## Install

1. Make sure you've first installed the [termux-api](https://play.google.com/store/apps/details?id=com.termux.api) on your Android device.
2. Then install the scripts with `apt install termux-api`.
3. Finally get this node module:

    $ `npm install --save termux-api-wrapper`

## Example usage

```javascript
const api = require('termux-api-wrapper')

if (!api.hasTermux) {
   console.error('Cannot init termux-api');
   process.exit(1)
}

api.dialog()
   .widget('spinner')
   .values(['One', 'Two'])
   .title('Select a number!')
   .run().then(console.log)
```

## Available methods

Every command instance has the `.run()` method that must be used to execute the command. It always return a Promise (eventually with results).


| Method | Description | Parameters |
|--------|-------------|-----------|
| `.toast()` | Show a toast message | |
| | set the text to show | `.text(<str>)` |
| | show the toast for a short while | `.transient()` |
| `.vibrate()` | Vibrate your phone | |
| | set the duration in milliseconds | `.duration(<ms>)` |
| | force vibration even in silent mode | `.force()` |
| `.batteryStatus()` | Get the status of the device battery | |
| `.cameraInfo()` | Get info about device camera(s) | |
| `.cameraPhoto()` | Take a photo and save it to a file (JPEG format) | |
| | select the camera by ID | `.camera(<id>)` |
| | output photo file (NB. use an absolute path!) | `.outputFile(<str>)` |
| `.clipboardGet()` | Get the system clipboard text | |
| `.clipboardSet()` | Set the system clipboard text | |
| | text to copy in clipboard | `.text(<str>)` |
| `.contactList()` | Set the system clipboard text | |
| `.contactList()` | List all contacts | |
| `.dialog()` | Show a text entry dialog | |
| | dialog title | `.title(<str>)` |
| | hint to show when input is empty | `.hint(<str>)` |
| | use a textarea with multiple lines | `.multipleLines()` |
| | enter the input as a password | `.password()` |
| `.download()` | Download a resource using the download manager | |
| | set the resource to download | `.url(<str>)` |
| | title for the download request | `.title(<str>)` |
| | description for the download request | `.description(<str>)` |
| `.infraredFrequencies()` | Query the infrared transmitter's supported carrier frequencies | |
| `.infraredTransmit()` | Transmit an infrared pattern | |
| | specify the pattern to transmit as array of numbers | `.frequency(<Array>)` |
| `.location()` | Get the device location | |
| | location provider (gps/network/passive) | `.provider(<enum>)` |
| | kind of request to make (once/last/updates) | `.request(<enum>)` |
| `.notification()` | Display a system notification | |
| | notification content to show | `.content(<str>)` |
| | notification id (will overwrite any previous notification with the same id)| `.id(<int>)` |
| | notification title to show | `.title(<str>)` |
| | notification url when clicking on it | `.url(<str>)` |
| | notification action when clicking on button1 | `.button1(<str>, <str>)` |
| | notification action when clicking on button2 | `.button2(<str>, <str>)` |
| | notification action when clicking on button3 | `.button3(<str>, <str>)` |
| | notification action when tapping on it | `.tap(<str>)` |
| | notification action when deleting it | `.delete(<str>)` |
| | notification image to show | `.image(<path>)` |
| | makes notification unremovable, need .id  | `.pin()` |
| `.share()` | share a file specified as argument | |
| | provide a file to share | `.file(<path>)` |
| | which action to perform on the file (edit/send/view) | `.action(<enum>)` |
| | content-type to use (default: guessed from file extension) | `.contentType(<str>)` |
| | share to the default receiver instead of showing a chooser | `.default()` |
| | title to use for shared content (default: shared file name) | `.title(<str>)` |
| `.smsInbox()` | List received SMS messages | |
| | show dates when messages were created | `.date()` |
| | limit in sms list (default: 10) | `.limit(<int>)` |
| | show phone numbers | `.showNumbers()` |
| | offset in sms list (default: 0) | `.offset(<int>)` |
| `.smsSend()` | Send a SMS message to the specified recipient number(s) | |
| | Recipient number(s), gotta be an Array | `.numbers(<Array>)` |
| | The SMS text | `.text(<str>)` |
| `.telephonyCellInfo()` | Get information about all observed cell information from all radios on the device | |
| `.telephonyDeviceInfo()` | Get information about the telephony device | |
| `.ttsEngines()` | Get information about the available text-to-speech (TTS) engines | |
| `.ttsSpeak()` | Speak text with a system text-to-speech (TTS) engine | |
| | Text to speak, passed to the engine | `.text(<str>)` |
| | TTS engine to use, see `.ttsEngines()` | `.engine(<id>)` |
| | language to use (may be unsupported by the engine) | `.language(<enum>)` |
| | pitch to use in speech (1.0 is normal) | `.pitch(<num>)` |
| | speech rate to use (1.0 is normal) | `.rate(<num>)` |
| | audio stream to use (ALARM/MUSIC/NOTIFICATION/RING/SYSTEM/VOICE_CALL) | `.stream(<enum>)` |


## Dependency

It uses [has-termux-api](https://github.com/roccomuso/has-termux-api) to check if termux-api is installed.

## Debug

Set the env DEBUG: `DEBUG=termux`
# License

MIT

---
_Source: https://npm.io/package/termux-api-wrapper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
