muzhang
let localhost = \'\'
try {
  const network = os.networkInterfaces()
  network[Object.keys(network)[0]].forEach(function(details) {
    if(localhost === \'\' && details.family === \'IPv4\' && !details.internal) {
      localhost = details.address
      return
    }
  });
} catch (e) {
  localhost = \'localhost\';
}

 

分类:

技术点:

相关文章:

  • 2021-10-30
  • 2021-10-14
  • 2022-02-18
  • 2021-10-21
  • 2022-02-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-25
  • 2021-12-24
  • 2021-09-13
  • 2022-12-23
  • 2021-10-16
  • 2021-06-12
相关资源
相似解决方案