MAC Address Getter
MAC Address Getter is a Node.js library for retrieving the MAC addresses from a machine's network interfaces. It provides functionalities to get either the first MAC address or all MAC addresses.
Installation
Use the package manager npm to install MAC Address Getter.
npm install --save-dev macaddress-local-machine
OR
yarn add -D macaddress-local-machine
Usage
import { first, all } from "macaddress-local-machine";
const macAddress = first();
console.log(macAddress);
const macAddresses = all();
console.log(macAddresses);
OR
import macAddr from "macaddress-local-machine";
const macAddress = macAddr.first();
console.log(macAddress);
const macAddresses = macAddr.all();
console.log(macAddresses);
Interface
interface MACAddress {
iface: string,
macAddr: string
}
{
"iface": "eno2",
"macAddr": "01:23:45:67:89:ab"
}
function first(throwErrorIfNoneFound: boolean = false): MACAddress | undefined;
function first(throwErrorIfNoneFound: boolean = true): MACAddress;
function all(throwErrorIfNoneFound: boolean = true): MACAddress[]