# rokng

> rebuilt package for ngrok v3

Latest version **1.2.0** (published 2023-01-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install rokng
pnpm add rokng
yarn add rokng
bun add rokng
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2023-01-26 |
| First published | 2022-07-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 51.3 KB |
| Known vulnerabilities | 0 (+37 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | 1nch |
| Maintainers | 1nch |
| Keywords | ngrok, tunnel, tcp, http, https |

## Links

- npm: https://www.npmjs.com/package/rokng
- Repository: https://github.com/1nchhh/rokng
- Homepage: https://github.com/1nchhh/rokng#readme
- Issues: https://github.com/1nchhh/rokng/issues
- npm.io page: https://npm.io/package/rokng

## Dependencies (6)

- [tar](https://npm.io/package/tar.md) ^6.1.11
- [axios](https://npm.io/package/axios.md) ^0.27.2
- [adm-zip](https://npm.io/package/adm-zip.md) ^0.5.9
- [@types/tar](https://npm.io/package/@types/tar.md) ^6.1.1
- [@types/node](https://npm.io/package/@types/node.md) ^18.0.0
- [@types/adm-zip](https://npm.io/package/@types/adm-zip.md) ^0.5.0

## Recent versions

- 1.2.0 (latest) — 2023-01-26
- 1.1.7 — 2022-07-17
- 1.1.6 — 2022-07-11
- 1.1.5 — 2022-07-11
- 1.1.4 — 2022-07-11
- 1.1.2 — 2022-07-11

## README

# ROKNG
This package is the unofficial wraper of [ngrok](https://ngrok.com) in a simple to use API.

## Install
```sh
npm install rokng
```

## Usage
```ts
// esm
import { Ngrok } from 'rokng';
// cjs
const Ngrok = require('rokng').default;

async function main() {
    // check if ngrok is installed
    const installed = Ngrok.isInstalled;

    // if ngrok isn't installed, install it
    if (!installed) {
        await Ngrok.install();
    }

    // start a TCP tunnel to port 8080
    const tunnel = await Ngrok.startTCPTunnel(8080);

    // get tunnel data
    const tunnelData = tunnel.getData();

    // get tunnel host and port
    const { host, port } = tunnelData;

    console.log(`Tunnel is up at ${host}:${port}`);

    // stop the tunnel
    tunnel.kill();

    // start an HTTPS tunnel to port 443
    const tunnel2 = await Ngrok.startHTTPSTunnel(443);

    // get tunnel data
    const tunnel2Data = await tunnel2.getData();

    // get tunnel host and port
    const { host: host2, port: port2 } = tunnel2Data;

    console.log(`Tunnel 2 is up at ${host2}:${port2}`);

    // stop the tunnel
    tunnel.kill();
}

main();
```

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