![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
node-macaddress
Advanced tools
Get the MAC addresses (hardware addresses) of the hosts network interfaces.
Retrieve MAC addresses in Linux, OS X, and Windows.
A common misconception about MAC addresses is that every host had one MAC address, while a host may have multiple MAC addresses – since every network interface may have its own MAC address.
This library allows to discover the MAC address per network interface and chooses
an appropriate interface if all you're interested in is one MAC address identifying
the host system (see API + Examples
below).
Features:
Linux
, Mac OS X
, Windows
, and on most UNIX
systems.node ≥ 0.12
and io.js
report MAC addresses in os.networkInterfaces()
this library utilizes this information when available.os.networkInterfaces()
(see API + Examples
below).npm install --save node-macaddress
var macaddress = require('node-macaddress');
(async) .one(iface, callback) → string
(async) .one(callback) → string
(async) .all(callback) → { iface: { type: address } }
(sync) .networkInterfaces() → { iface: { type: address } }
.one([iface], callback)
Retrieves the MAC address of the given iface
.
If iface
is omitted, this function automatically chooses an
appropriate device (e.g. eth0
in Linux, en0
in OS X, etc.).
Without iface
parameter:
macaddress.one(function (err, mac) {
console.log("Mac address for this host: %s", mac);
});
→ Mac address for this host: ab:42:de:13:ef:37
With iface
parameter:
macaddress.one('awdl0', function (err, mac) {
console.log("Mac address for awdl0: %s", mac);
});
→ Mac address for awdl0: ab:cd:ef:34:12:56
.all(callback)
Retrieves the MAC addresses for all non-internal interfaces.
macaddress.all(function (err, all) {
console.log(JSON.stringify(all, null, 2));
});
{
"en0": {
"ipv6": "fe80::cae0:ebff:fe14:1da9",
"ipv4": "192.168.178.20",
"mac": "ab:42:de:13:ef:37"
},
"awdl0": {
"ipv6": "fe80::58b9:daff:fea9:23a9",
"mac": "ab:cd:ef:34:12:56"
}
}
.networkInterfaces()
A useful replacement of os.networkInterfaces()
. Reports only non-internal interfaces.
console.log(JSON.stringify(macaddress.networkInterfaces(), null, 2));
{
"en0": {
"ipv6": "fe80::cae0:ebff:fe14:1dab",
"ipv4": "192.168.178.22"
},
"awdl0": {
"ipv6": "fe80::58b9:daff:fea9:23a9"
}
}
FAQs
Get the MAC addresses (hardware addresses) of the hosts network interfaces.
We found that node-macaddress demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.