Skip to content

A tiny util for discovering alive hosts in local network

License

Notifications You must be signed in to change notification settings

ubcent/ping-subnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ping-subnet

A tiny util for discovering alive hosts in local network. It is fully compatible with the native nodejs EventEmmiter

Installation

npm install ping-subnet

Usage

You can specify the custom ranges parameter.

Ranges parameter is represented by array of strings. There are two possible forms: just a single IP or the range.

const SubnetsPinger = require('ping-subnet');

const ranges = [
  '192.168.0.123',
  '192.168.0.1-192.168.0.100'
];

const subnetPinger = new SubnetsPinger(ranges);

subnetPinger.on('host:alive', ip => {
  console.log('alive', ip);
});

subnetPinger.once('ping:end', () => {
  console.log('ping completed');
});

subnetPinger.ping();

If the custom ranges is not specified it would be assigned using current network settings

const SubnetsPinger = require('ping-subnet');

const subnetPinger = new SubnetsPinger();

subnetPinger.on('host:alive', ip => {
  console.log('alive', ip);
});

subnetPinger.once('ping:end', () => {
  console.log('ping completed');
});

subnetPinger.ping();

About

A tiny util for discovering alive hosts in local network

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published