r2bot
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

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();

Package Sidebar

Install

npm i r2bot

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

6.91 kB

Total Files

7

Last publish

Collaborators

  • zhangguangyan