Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

portscanner

Package Overview
Dependencies
Maintainers
4
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

portscanner

Asynchronous port scanner for Node.js

  • 2.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4M
increased by0.65%
Maintainers
4
Weekly downloads
 
Created

What is portscanner?

The portscanner npm package is a utility for scanning and checking the status of ports on a given host. It can be used to find open ports, check if a specific port is open, and find the first open port within a range.

What are portscanner's main functionalities?

Check if a specific port is open

This feature allows you to check if a specific port on a given host is open or closed. The code sample demonstrates how to check the status of port 3000 on localhost.

const portscanner = require('portscanner');

portscanner.checkPortStatus(3000, '127.0.0.1', (error, status) => {
  if (error) throw error;
  console.log(`Port 3000 is ${status}`); // 'open' or 'closed'
});

Find the first open port in a range

This feature allows you to find the first open port within a specified range on a given host. The code sample demonstrates how to find the first open port between 3000 and 3010 on localhost.

const portscanner = require('portscanner');

portscanner.findAPortNotInUse(3000, 3010, '127.0.0.1', (error, port) => {
  if (error) throw error;
  console.log(`First open port is ${port}`);
});

Find the first port in use in a range

This feature allows you to find the first port that is in use within a specified range on a given host. The code sample demonstrates how to find the first port in use between 3000 and 3010 on localhost.

const portscanner = require('portscanner');

portscanner.findAPortInUse(3000, 3010, '127.0.0.1', (error, port) => {
  if (error) throw error;
  console.log(`First port in use is ${port}`);
});

Other packages similar to portscanner

Keywords

FAQs

Package last updated on 14 May 2018

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc