node-localip
Simple tool that gives you the local, prefered (default/active) IPv4 addresses.Install
As a command line tool$ (sudo) npm install node-localip -g
As a node module:$ npm install node-localip
Usage
Command line:$ localip
10.58.100.191
$
Node module:var getLocalIp = require( "node-localip" );
getLocalIp( function ( err, ip ) {
console.log( err || ip );
} );
... or, list all local IPv4 addresses with the prefered as the first ...getLocalIp.list( function ( err, ipList ) {
console.log( err || ipList );
} );