Skip to content

The portscanner module is an asynchronous JavaScript port scanner for Node.js.

License

Notifications You must be signed in to change notification settings

ChrisChou-freeman/portsScanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

portscanner

Zero dependence

require

node >= 14

Install

npm install async-portscanner 

Usage

A brief example:

// using in ES module
import {findAPortInUse, findAPortNotInUse} from 'async-portsscanner';

findAPortInUse({startPort: 2999, endPort: 3002, host: '127.0.0.1'})
  .then(data=>{
    const {error, port} = data;
    console.log(error, port);
  });

findAPortNotInUse({portList: [2999, 3000, 3001]})
  .then(data=>{
    const {error, port} = data;
    console.log(error, port);
  })
// using in commonJS
import('async-portsscanner')
  .then(data=>{
    const {findAPortInUse, findAPortNotInUse} = data;
    findAPortInUse({startPort: 2999, endPort: 3002, host: '127.0.0.1'})
      .then(data=>{
        const {error, port} = data;
        console.log(error, port);
      });

    findAPortNotInUse({portList: [2999, 3000, 3001]})
      .then(data=>{
        const {error, port} = data;
        console.log(error, port);
      })
  })

Test

npm test

About

The portscanner module is an asynchronous JavaScript port scanner for Node.js.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published