var os = require('os');
function localIPs(custom_filter) {
/* default: only IPv4 and non internal */
custom_filter = custom_filter || function (i) { return i.family === 'IPv4' && !i.internal; };
var ni = os.networkInterfaces();
return Array.prototype.concat.apply(Array.prototype,
Object.keys(ni)
.filter(function (k) { return k !== 'lo'; }) /* ignore loopback */
.map(function (k) { return ni[k]; }) /* get value */
) /* flatten */
.filter(custom_filter)
.map(function (a) { return a.address; }); /* get address */
}
console.log(localIPs());