Retrieving a List of network interfaces in node.js (ioctl SIOCGIFCONF)
If you want to list only the name of interfaces :
Object.keys(os.getNetworkInterfaces())
// [ 'lo0', 'en0', 'en3', 'awdl0' ]
Update valid as of Node 13.7.0
This has been renamed since this answer was submitted. It is now just networkInterfaces()
like this:
require('os').networkInterfaces()
Or probably preferably like this:
import { networkInterfaces } from 'os';
const interfaces = networkInterfaces();
New docs url: https://nodejs.org/docs/latest/api/os.html#os_os_networkinterfaces
Original answer
As of Node.js 0.6.0 you have
require('os').getNetworkInterfaces()
See http://nodejs.org/docs/latest/api/os.html#os.getNetworkInterfaces