0.3.1 • Published 8 years ago
device-discovery v0.3.1
device-discovery
Discover devices on your local network.
Installation
npm install device-discoveryQuickstart
const discovery = require('device-discovery')
({ type: 'ICMP', iface: 'WiFi' })
discovery.on('device', console.log)
// => 192.168.0.20
// 192.168.0.31
// ...
discovery.on('done', () =>
console.log('Done!'))API
require('device-discovery')(options)
- options
<Object>- type
<String>: default =ICMP; the protocol used for device discovery, one ofICMPorTCP - iface
<String>: default =WiFi; the interface on which to scan for devices - start
<Number>: default =2; the start of the range of hosts to be scanned - end
<Number>: default =254; the end of the range of hosts to be scanned - port
<Number>: default =1; the port to be scanned (TCPonly) - timeout
<Number>: default =3000; the timeout after which the scan of a host will be considered a miss - retries
<Number>: default =0; the number of retries for pinging a host (ICMPonly) - excludeSelf
<Boolean>: default =true; whether to exclude the device the discovery is run on
- type
- throws an
<Error>if the interface cannot be found or the type is unknown - returns an
<EventEmitter>with the following events:- device =>
<String>: the IPv4 address of the device found - done =>
(): if the discovery is done
- device =>
License
WTFPL – Do What the F*ck You Want to Public License.
Made with :heart: by @MarkTiedemann.