diff --git a/index.js b/index.js index 174dc34..3048a0b 100644 --- a/index.js +++ b/index.js @@ -33,6 +33,9 @@ switch(process.platform) { case "openbsd": config = require("./platform/openbsd"); break; + case "android": + config = require("./platform/android"); + break; default: throw new Error("Unknown platform: '" + process.platform + "'. Send this error to xavi.rmz@gmail.com."); } diff --git a/platform/android.js b/platform/android.js new file mode 100644 index 0000000..4fc2a9a --- /dev/null +++ b/platform/android.js @@ -0,0 +1,9 @@ +exports.copy = { command: "termux-clipboard-set", args: [] }; +exports.paste = { command: "termux-clipboard-get", args: [] }; +exports.paste.full_command = exports.paste.command; +exports.encode = function(str) { return new Buffer(str, "utf8"); }; +exports.decode = function(chunks) { + if(!Array.isArray(chunks)) { chunks = [ chunks ]; } + + return Buffer.concat(chunks).toString("utf8"); +};