Socket
Socket
Sign inDemoInstall

is-port-reachable

Package Overview
Dependencies
1
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    is-port-reachable

Check if a local or remote port is reachable


Version published
Maintainers
1
Install size
8.47 kB
Created

Package description

What is is-port-reachable?

The is-port-reachable npm package is used to check if a port is reachable on a given host. It is useful for network diagnostics and monitoring, allowing developers to programmatically verify if services are accessible over the network.

What are is-port-reachable's main functionalities?

Check port reachability

This feature allows you to check if a specific port on a host is reachable. The function returns a boolean indicating whether the port is open or not.

const isPortReachable = require('is-port-reachable');

(async () => {
  const reachable = await isPortReachable(80, {host: 'example.com'});
  console.log(reachable); // true or false
})();

Other packages similar to is-port-reachable

Readme

Source

is-port-reachable Build Status

Check if a local or remote port is reachable

Install

$ npm install --save is-port-reachable

Usage

var isPortReachable = require('is-port-reachable');

isPortReachable(80, {host: 'google.com'}, function (err, reachable) {
	console.log(reachable);
	//=> true
});
//=>

API

isPortReachable(port, [options], callback)

port

Type: number

options
host

Type: string
Default: localhost

Can be a domain or an IP.

timeout

Type: number
Default: 1000

Milliseconds to wait before giving up.

callback(error, reachable)
error

Type: null

It's there by Node.js convention, but will always be null.

reachable

Type: boolean

License

MIT © Sindre Sorhus

Keywords

FAQs

Last updated on 24 Aug 2015

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc