Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
is-port-reachable
Advanced tools
Check if a local or remote port is reachable
Weekly downloads
Package description
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.
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
})();
The portscanner package is similar to is-port-reachable and provides more comprehensive functionality for scanning ports, including checking a range of ports and providing detailed status for each port.
tcp-ping allows you to perform TCP pings to a server, which includes checking if a port is open. It provides additional information such as latency measurements, which is-port-reachable does not offer.
wait-for-port is another package that can be used to wait for a port on a host to become available. It is useful for scenarios where you need to wait for a service to start up before performing actions that depend on that service.
Readme
Check if a local or remote port is reachable
npm install is-port-reachable
import isPortReachable from 'is-port-reachable';
console.log(await isPortReachable(80, {host: 'google.com'}));
//=> true
Returns Promise<boolean>
for whether the port is reachable.
Type: number
The port to check.
Type: object
Required
Type: string
Example: 'localhost'
The host to check.
Can be a domain (optionally, with a sub-domain) or an IP address.
Type: number
Default: 1000
The time to wait in milliseconds before giving up.
FAQs
Check if a local or remote port is reachable
The npm package is-port-reachable receives a total of 1,194,118 weekly downloads. As such, is-port-reachable popularity was classified as popular.
We found that is-port-reachable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
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.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.