Similar to this question in C#, is it possible in NodeJS to get the MAC address(es) of a computer when disconnected from a network?
I have been using the macaddress module, which works great when the user is connected to a network -- but if the user disconnects, macaddress
will not return any addresses on some systems.
I noticed some differences between os.networkInterfaces()
when a user is offline/online, as well as differences in behavior across Windows/Mac and Node v10/v12. I'm not really sure where the problem actually lies here.
I just tested with getmac module and works fine offline (and online).
You can try it like this:
If you don't want to use a module you can also ask for each mac address interface like this (node >= 0.11):
And then parse it depending of your needs.
The result should look like this: