r2bot
v0.0.3
Published
infrastructure as code in pure javascript
Downloads
5
Maintainers
Readme
r2bot(r2-d2)
Infrastructure as code in pure javascript.
Warning
This project is still in its very early stage.
Installation
To install the package, run this inside your project's folder.
$ npm i -D r2bot
Usage
import { ssh } from "r2bot";
// setup ssh connection
const r2 = await ssh("<host name or ip>", "<user name>", "<password>");
// run commands
const { code, message } = await r2.exec("uptime");
console.log(`code: ${code}, message: ${message}`);
// run commands when root permission is needed, i.e. sudo apt update
// please make sure the user must have sudo permission
await r2.sudoExec("apt update");
// close the connection
r2.close();