UNPKG

@dderevjanik/termux-api

Version:

This library allows you to interact with your Android device from Node.js using termux-api

24 lines (23 loc) 753 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.wifiScanInfo = wifiScanInfo; const child_process_1 = require("child_process"); /** * Get information about the last wifi scan */ async function wifiScanInfo() { return new Promise((resolve, reject) => { const command = `termux-wifi-scaninfo`; (0, child_process_1.exec)(command, (error, stdout, stderr) => { if (error) { return reject(`Error: ${error.message}`); } if (stderr) { return reject(`Error: ${stderr}`); } const output = stdout.trim(); const networks = JSON.parse(output); return resolve(networks); }); }); }