node-unique-machine-id
Get the unique machine id (cross-platform, without admin privileges)
Installation
npm install node-unique-machine-id
Usage
import { machineId, machineIdSync } from 'node-unique-machine-id';
machineId().then(id => {
console.log(id);
});
const id = machineIdSync(true);
console.log(id);
API
machineId(original?:boolean, fallthrough?: boolean)
machineIdSync(original?:boolean, fallthrough?: boolean)
original: default: false
. If true
return original value of machine id, otherwise return hashed value (sha-256)
fallthrough: default: false
. If true
, uuid will be generated and saved when there is an error in obtaining (use for Unsupported platforms)
Thanks