3.0.0-next.1574041521.013b481b7751b71f64e4b68a64e9d9854ed0c593 • Published 6 years ago

getmac v3.0.0-next.1574041521.013b481b7751b71f64e4b68a64e9d9854ed0c593

Weekly downloads
12,585
License
MIT
Repository
github
Last release
6 years ago

Get the mac address of the current machine you are on

Will run anywhere that the underlying commands are present:

  • On Windows, getmac is used

  • On Unix/Linux/Mac, ifconfig is used if present, otherwise ip is used

  • Other environments are not supported as they provide no way of fetching the mac address.

That means:

  • If you are building a server app, or a desktop app, and wanting to get the mac address of where the node.js process is run, then this will work as expected.

  • If you are building a server app, this will only get the mac address of the server. There is no way to get a web browser user's mac address without installing software on their computer.

  • If you are building an electron app, you can run this on the server-side then communicate it to the client side.

  • This library will not run in web browsers / on the client-side / in webpack / in browserify / in angular / in react / in jQuery / in HTML. It will only run on node.js environments, which the web browser is not.

npm

Usage

API Documentation

CLI

Install globally npm install -g getmac, then run with getmac-node

API

Install locally npm install --save getmac, then use like so:

import getMAC, { isMAC } from 'getmac'

// Fetch the computer's MAC address
getMAC(function(err, macAddress) {
    if (err) throw err
    console.log(macAddress)
})

// Fetch the computer's MAC address for a specific interace
getMAC('eth0', function(err, macAddress) {
    if (err) throw err
    console.log(macAddress)
})

// Validate that an address is a MAC address
if (isMAC('e4:ce:8f:5b:a7:fc')) {
    console.log('valid MAC')
} else {
    console.log('invalid MAC')
}

Discover the release history by heading on over to the HISTORY.md file.

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

These amazing people are maintaining this project:

No sponsors yet! Will you be the first?

These amazing people have contributed code to this project:

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

Unless stated otherwise all works are:

and licensed under:

6.5.0

2 years ago

6.6.0

2 years ago

6.1.0

2 years ago

6.2.0

2 years ago

6.3.0

2 years ago

5.21.0

2 years ago

6.0.0

2 years ago

6.4.0

2 years ago

5.20.0

5 years ago

5.19.0

5 years ago

5.18.0

5 years ago

5.17.0

5 years ago

5.16.0

6 years ago

5.15.0

6 years ago

5.14.0

6 years ago

5.13.0

6 years ago

5.12.0

6 years ago

5.11.0

6 years ago

5.10.0

6 years ago

5.9.0

6 years ago

5.8.0

6 years ago

5.6.0

6 years ago

5.7.0

6 years ago

5.5.0

6 years ago

5.4.0

6 years ago

5.3.0

6 years ago

5.2.0

6 years ago

5.1.0

6 years ago

5.0.0

6 years ago

4.4.0

6 years ago

4.3.0

6 years ago

4.2.0

6 years ago

4.1.0

6 years ago

4.0.1

6 years ago

4.0.0

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.0

6 years ago

1.5.0

6 years ago

1.4.6

8 years ago

1.4.5

8 years ago

1.4.4

8 years ago

1.4.3

8 years ago

1.4.2

8 years ago

1.4.1

8 years ago

1.4.0

8 years ago

1.3.0

8 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.7

11 years ago

1.0.6

12 years ago

1.0.5

13 years ago

1.0.4

13 years ago

1.0.3

13 years ago

1.0.2

13 years ago

1.0.1

13 years ago

1.0.0

13 years ago