network-everywhere
Goal
os.networkInterfaces()
only return interfaces that have been assigned a network address. This package has been made to ensure that we always retrieve a mac address (even if we are offline or the wire is unplugged).
Usage
const { networkEverywhere } = require('network-everywhere')
try {
const activeInterface = await networkEverywhere.getActiveInterface()
const ipAddress = await networkEverywhere.getIpAddress()
const allMacAddresses = await networkEverywhere.getAllMacAddresses()
console.log('activeInterface:', activeInterface)
console.log('ipAddress:', ipAddress)
console.log('allMacAddresses:', allMacAddresses)
} catch(e) {
console.error(e)
}