device-discovery
Discover devices on your local network.
Installation
npm install device-discovery
Quickstart
const discovery = type: 'ICMP' iface: 'WiFi' discovery // => 192.168.0.20 // 192.168.0.31 // ... discovery
API
require('device-discovery')(options)
- options
<Object>
- type
<String>
: default =ICMP
; the protocol used for device discovery, one ofICMP
orTCP
- 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 (TCP
only) - 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 (ICMP
only) - 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 ❤️ by @MarkTiedemann.