Skip to content

Gets the system MAC addresses from a node.js program

Notifications You must be signed in to change notification settings

AkashiX/mac-address

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

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');
    }
});

About

Gets the system MAC addresses from a node.js program

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%