# ssh2-promisify

> SSH2-Promisify is a wrapper around ssh2. It support all the features of ssh2 package in addition with other functions which return result in a promisify manner. The main purpose of this package is to execute multiple commands at different stages in an int

Latest version **1.0.1** (published 2020-05-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install ssh2-promisify
pnpm add ssh2-promisify
yarn add ssh2-promisify
bun add ssh2-promisify
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-05-11 |
| First published | 2020-05-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Arslan Fareed |
| Maintainers | arslanfareed |

## Links

- npm: https://www.npmjs.com/package/ssh2-promisify
- npm.io page: https://npm.io/package/ssh2-promisify

## Dependencies (1)

- [ssh2](https://npm.io/package/ssh2.md) ^0.8.9

## Recent versions

- 1.0.1 (latest) — 2020-05-11
- 1.0.0 — 2020-05-11

## README

# SSH2-Promisify

SSH2-Promisify is a wrapper around ssh2. It support all the features of ssh2 package in addition with other functions which return result in a promisify manner. The main purpose of this package is to execute multiple commands at different stages in an interactive mode using a single shell session. This can be achieved by calling exec() function multiple time in your code when ever you want to execute a single command or a block of commands.

## Getting Started

### Prerequisites

1. Install Node

### Installing

```
npm i ssh2-promisify
```

## Usage


```
const SSH2Promisify = require('./ssh')
const express = require('express')
const app = express()
const port = 3000

app.listen(port, () => console.log(`SSH2-Promisify app listening at http://localhost:${port}`))
```

```
app.get('/', async (req, res) => {

    const ssh2Promisify = new SSH2Promisify()
    
    ssh2Promisify.connect({
      host: '',
      port: 22,
      username: '',
      password: ''
    })

    const session = await ssh2Promisify.startSession(ssh2Promisify)

    const result1 = await ssh2Promisify.exec(session, command1)
    console.log(result1)

    const result2 = await ssh2Promisify.exec(session, command2)
    console.log(result2)

    ssh2Promisify.endSession(ssh2Promisify)
    
    const Response = {
      ResponseCode: '000',
      ResponseStatus: 'SUCCESS',
      Response: {
        result1: result1,
        result2: result2
      }
    }

    res.status(200).send(Response)
})
```


## Author

* **Arslan Fareed**

---
_Source: https://npm.io/package/ssh2-promisify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
