node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


Interface Addresses

Build Status

Get the IPv4 addresses of all network interfaces on a machine


npm install -S interface-addresses


Require the module and call it with no arguments. The returned addresses value will be an object where the key is the name of the interface and the value is the ip address

var inspect = require('eyespect').inspector()
var interfaceAddresses = require('interface-addresses')
var addresses = interfaceAddresses()
inspect(addresses, 'network interface IPv4 addresses (non-internal only)')

In the example above, addresses is an object that looks like the following

    en1: '',
    vnic0: '',
    vnic1: '',
    vboxnet0: ''

You will need to install the eyespect module to run the example code above, which you can do using npm

npm install -S eyespect


# install the development dependencies
npm install
# run the tests
npm test