node-network-scan
v1.0.9
Published
Scan network and find available devices.
Downloads
14
Maintainers
Readme
Node Network Scanner
This library is for scan local network and find available devices.
Installation
npm install node-network-scanner
# or
yarn add node-network-scanner
# or
pnpm add node-network-scanner
Usage
Find all available devices on local network.
const networkScanner = new NetworkScanner();
networkScanner.getAllDevices().then((res) => console.log(res));
Find all available devices on specific network interface by interface address.
const networkScanner = new NetworkScanner();
networkScanner
.getAllDevicesByFilter({ interfaceAddress: "192.168.1.86" })
.then((res) => {
console.log(res);
});
Find all available devices on specific network interface by interface address and with specific TCP port.
const networkScanner = new NetworkScanner();
networkScanner
.getAllDevicesByFilter({ interfaceAddress: "192.168.1.86" }, 433)
.then((res) => {
console.log(res);
});
Find all available devices on specific network interface by mac address.
const networkScanner = new NetworkScanner();
networkScanner
.getAllDevicesByFilter({ mac: "xx-xx-xx-xx-xx-xx" })
.then((res) => {
console.log(res);
});
Output
[
{ "ipAddress": "192.168.1.1", "macAddress": "..." },
{ "ipAddress": "192.168.1.20", "macAddress": "..." },
{ "ipAddress": "192.168.1.21", "macAddress": "..." },
{ "ipAddress": "192.168.1.27", "macAddress": "..." },
{ "ipAddress": "192.168.1.86", "macAddress": "..." },
{ "ipAddress": "192.168.1.136", "macAddress": "..." }
]
Test
npm run test
I am still trying to optimize the performance of pinging devices.