internal-ip
Get your internal IPv4 address
Last updated 10 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install internal-ip 
SYNC missed versions from official npm registry.

internal-ip

Get your internal IP address

Install

npm install internal-ip

Usage

import {internalIpV6, internalIpV4} from 'internal-ip';

console.log(await internalIpV6());
//=> 'fe80::1'

console.log(await internalIpV4());
//=> '10.0.0.79'

API

The package returns the address of the internet-facing interface, as determined from the default gateway. When the address cannot be determined for any reason, undefined will be returned.

The package relies on operating systems tools. On Linux and Android, the ip command must be available, which depending on distribution might not be installed by default. It is usually provided by the iproute2 package. internalIpV6Sync() and internalIpV4Sync() are not supported in browsers and just return undefined.

internalIpV6()

Returns the internal IPv6 address asynchronously.

internalIpV4()

Returns the internal IPv4 address asynchronously.

internalIpV6Sync()

Returns the internal IPv6 address synchronously.

internalIpV4Sync()

Returns the internal IPv4 address synchronously.

Related

Current Tags

  • 8.0.0                                ...           latest (a year ago)

20 Versions

  • 8.0.0                                ...           a year ago
  • 7.0.0                                ...           3 years ago
  • 6.2.0                                ...           4 years ago
  • 6.1.0                                ...           4 years ago
  • 6.0.0                                ...           5 years ago
  • 5.0.0                                ...           5 years ago
  • 4.3.0                                ...           6 years ago
  • 4.2.0                                ...           6 years ago
  • 4.1.0                                ...           6 years ago
  • 4.0.0                                ...           6 years ago
  • 3.0.1                                ...           7 years ago
  • 3.0.0                                ...           7 years ago
  • 2.0.3                                ...           7 years ago
  • 2.0.2                                ...           7 years ago
  • 2.0.1                                ...           7 years ago
  • 2.0.0                                ...           7 years ago
  • 1.2.0                                ...           9 years ago
  • 1.1.0                                ...           9 years ago
  • 1.0.1                                ...           9 years ago
  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Total 12
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE