ip-in

1.2.5 • Public • Published

ip-in

IP address and User Country information data get utilities for javaScript .

Installation

Install my-project with npm

  npm i ip-in

Usage/Examples for node

IP Address:

const ip = require('ip-in')

ip.getIpAddress()
.then(data => {
    console.log('ipAddress :',data)
})

Result:

ipAddress : 163.172.90.118

user location details

ip.getCountryDetails()
.then(data => {
  console.log('countryDetails:',data)
})

Result:

countryDetails : {
  status: 'success',
  ip: '163.172.90.118',
  country: 'France',
  countryCode: 'FR',
  region: 'IDF',
  regionName: 'Île-de-France',
  city: 'Paris',
  zip: '75001',
  lat: 48.8534,
  lon: 2.3488,
  timezone: 'Europe/Paris',
  isp: 'Online S.A.S.',
  org: 'ONLINE',
  as: 'AS12876 ONLINE S.A.S.',
  mobile: false,
  proxy: true
}

Or using ES modules and async/await:

import ip from 'ip-in';

(async () => {
   let ipAddress = await ip.getIpAddress()
  console.log('ipAddress',ipAddress)

  let countryDetails = await ip.getCountryDetails()
  console.log('countryDetails',countryDetails)
})();

Package Sidebar

Install

npm i ip-in

Weekly Downloads

19

Version

1.2.5

License

ISC

Unpacked Size

3.43 kB

Total Files

3

Last publish

Collaborators

  • lmhasib