UNPKG

@dderevjanik/termux-api

Version:

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

23 lines (22 loc) 718 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.clipboardSet = clipboardSet; const child_process_1 = require("child_process"); /** * Set the system clipboard text */ async function clipboardSet(options) { return new Promise((resolve, reject) => { // TODO: Fix escape characters in text "" const command = `termux-clipboard-set "${options.text}"`; (0, child_process_1.exec)(command, (error, stdout, stderr) => { if (error) { return reject(`Error: ${error.message}`); } if (stderr) { return reject(`Error: ${stderr}`); } return resolve(); }); }); }