Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 719 Bytes

README.md

File metadata and controls

27 lines (21 loc) · 719 Bytes

macaddr.js

Gets the MAC addresses for the current machine.

Comes in two forms, one to get the first address found, and one to get them all.

var macaddr = require('macaddr');

macaddr.address()

macaddr.address(function(err, addr) {
    if (addr) {
        console.log('MAC address: ' + addr);
    } else {
        console.log('MAC address not found');
    }
});

macaddr.all_addresses()

macaddr.all_addresses(function(err, addrs) {
    if (addrs && addrs.length > 0) {
        console.log('MAC addresses: ' + JSON.stringify(addrs));
    } else {
        console.log('No MAC addresses found');
    }
});