@dderevjanik/termux-api
Version:
This library allows you to interact with your Android device from Node.js using termux-api
22 lines (21 loc) • 627 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.torch = torch;
const child_process_1 = require("child_process");
/**
* Toggle LED Torch on device
*/
async function torch(status) {
return new Promise((resolve, reject) => {
const command = `termux-torch ${status}`;
(0, child_process_1.exec)(command, (error, stdout, stderr) => {
if (error) {
return reject(`Error: ${error.message}`);
}
if (stderr) {
return reject(`Error: ${stderr}`);
}
return resolve();
});
});
}