Closed vodolazov closed 4 years ago
yea not sure why as windows should have arp -a
command as well. however if you want to you can catch errors and use child-process to spawn and run command arp -a
on windows then split the return with '\n' skip the first two lines as they will hold the devices IP and garbage then use regex to pull out the IPS from each line
I believe this is now supported with 2.0.0 🎉
It doesn't work with 2.0.0. I created a pull request that fix this problem. :) I tested the solution with a Win7/10.
Just tried on a Windows 10 machine.
When I type arp -a
I get:
Interface: 172.20.1.190 --- 0x7
Internet Address Physical Address Type
10.128.128.128 e0-cb-bc-34-81-03 dynamic
172.20.0.1 0c-8d-db-6b-72-18 dynamic
172.20.0.151 08-3e-8e-04-7f-b2 dynamic
172.20.0.194 e8-e8-b7-6f-6a-a2 dynamic
172.20.7.255 ff-ff-ff-ff-ff-ff static
224.0.0.2 01-00-5e-00-00-02 static
224.0.0.22 01-00-5e-00-00-16 static
224.0.0.251 01-00-5e-00-00-fb static
224.0.0.252 01-00-5e-00-00-fc static
239.255.255.250 01-00-5e-7f-ff-fa static
Interface: 10.0.75.1 --- 0xe
Internet Address Physical Address Type
10.0.75.255 ff-ff-ff-ff-ff-ff static
224.0.0.22 01-00-5e-00-00-16 static
224.0.0.251 01-00-5e-00-00-fb static
224.0.0.252 01-00-5e-00-00-fc static
239.255.255.250 01-00-5e-7f-ff-fa static
Interface: 172.17.109.225 --- 0x23
Internet Address Physical Address Type
172.17.109.239 ff-ff-ff-ff-ff-ff static
224.0.0.22 01-00-5e-00-00-16 static
224.0.0.251 01-00-5e-00-00-fb static
224.0.0.252 01-00-5e-00-00-fc static
239.255.255.250 01-00-5e-7f-ff-fa static
255.255.255.255 ff-ff-ff-ff-ff-ff static
but when I run this (see below) I get 0 devices:
const find = require("local-devices");
console.log(`Platform: ${process.platform}`);
find()
.then(devices => {
console.log("Devices found:" + devices.length);
devices.forEach(device => {
console.table(device.name, device.ip, device.mac);
});
})
.catch(error => console.error(error));
Tested with 2.0.0
and Node v10.16.0
Same issue here
Hi @Blackfaded @Stwissel, thanks for the report. I'll take a look at it and let you know about any progress. Feel free to open a PR, if you have time or an idea about how to handle it. Thanks.
Hello everyone,
I just published a newer version on npm. It includes the fix you asked for, which was previously not published.
Let us know if it works. please. Thank you!
//cc @LucaSoldi
Awesome lib, but does not work on windows (win10)