简体   繁体   English

在Node.js中获取我用于连接互联网的MAC地址吗?

[英]Get the MAC address i'm using to connect to internet, in nodejs?

I'm using macaddress , but I don't know how to get the mac address what I'm using to connect to the internet 我正在使用macaddress ,但是我不知道如何获取我用来连接互联网的mac地址

const macaddress = require('macaddress');

macaddress.all(function (err, all) {
  console.log("Your mac address is -->" + JSON.stringify(all, null, 2));
});

try .one function for one interface 为一个接口尝试.one函数

require('node-macaddress').one(function (err, addr) { console.log(addr); }

On node ≥ 0.11 you are not required to use the asynchronous version try 在节点≥0.11上,不需要使用异步版本try

var addr = require('node-macaddress').one();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 NodeJS - 离线时获取MAC地址 - NodeJS - get MAC address when offline 是否可以使用javascript获取mac地址? - is it possible to get the mac address using the javascript? 如何使用Javascript在Firefox中获取MAC地址? - How to get MAC Address in Firefox using Javascript? 我正在使用“帆”:“~1.2.4”。 我正在尝试连接到 MongoDb。 但是当我尝试扬帆起航时,我收到了这个错误: - I'm using “sails”: “~1.2.4”. I'm trying to connect to a MongoDb. But When I try to sails lift I get this error: 我可以获取访客的路由器名称或MAC地址吗? - Can I get the visitor's router name or MAC address? 我有一个联系表单,我尝试使用Angularjs将其与PHP邮件连接,并在php文件中获取数据 - I have a Contact form, and i'm try to connect it with PHP mail using Angularjs and get get data in php file 如何使用 PHP 获取网站连接设备的 IMEI 或 MAC 地址 - How to get a website connected device IMEI or MAC Address using PHP 在学习 NodeJs 时,我遇到了“无法获得‘地址’”的问题 - While studying NodeJs i got "cannot get 'address' " problem NodeJs:错误 401(未经授权)我正在使用 passport-jwt - NodeJs :Error 401(Unauthorized) i m using passport-jwt 使用Node.js连接到RavenDB - Connect to RavenDB using nodejs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM