New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ngrok-v3

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngrok-v3

rebuilt package for ngrok v3

latest
Source
npmnpm
Version
1.1.4
Version published
Weekly downloads
8
Maintainers
1
Weekly downloads
 
Created
Source

NOTE

ngrok-v3 is deprecated due to this package being renamed to rokng. Please use rokng instead. This package will not be updated in the future.

ROKNG

This package is the unofficial wraper of ngrok in a simple to use API.

Install

npm install rokng

Usage

import { Ngrok } from 'rokng';


async function main() {
    // check if ngrok is installed
    const installed = Ngrok.isInstalled;

    // if ngrok isn't installed, install it
    if (!installed) {
        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();

Keywords

ngrok

FAQs

Package last updated on 11 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts