2

I am building a desktop app using electronjs. I want to be able to identify a machine uniquely. I believe it should be ok to use mac address of the machine as unique identifier. I don't know how to get mac address of the machine. Couldn't find any good example on internet. Appreciate all the help.

Thank you.

Rishi Dev
  • 187
  • 2
  • 12
  • 1
    Or perhaps this one: [get the mac address of the current machine with node.js using getmac](https://stackoverflow.com/questions/16386371/get-the-mac-address-of-the-current-machine-with-node-js-using-getmac) – Brettski Mar 07 '21 at 04:59

1 Answers1

3

I am new to electronjs (and nodejs too), so this is main reason I find getting things done difficult. Thank you @Brettski for suggestions in the comments. Following commands and script worked for me:

  1. Installed getmac in my local electronjs project folder, by running this command.
    npm install --save getmac

  2. In the JavaScript created getmac variable by importing getmac module
    const getmac = require('getmac')

  3. Ready to use, by invoking it's default function:
    console.log(getmac.default())

    I couldn't successfully run getMAC() function, but default() worked. I guess, I need to understand what args to pass etc.

Rishi Dev
  • 187
  • 2
  • 12