2.1.0 • Published 3 years ago

geo-from-ip v2.1.0

Weekly downloads
244
License
MIT
Repository
github
Last release
3 years ago

geo-from-ip

Get geolocation 🌐 information about an IP 📲

Build Status NPM Version NPM Download

Features

  • No frills install 🚀
  • Downloads GeoLite2 databases automatically during installation 🔋
  • Run npm install to upgrade databases which means automatic updates on deployments 💎

How to use

  • Include package in your project
npm install --save geo-from-ip
# or, if you are using yarn
yarn add --save geo-from-ip
  • Set MAXMIND_LICENSE_KEY=<your_maxmind_license_key> in your environment variables. Read more about this change on MaxMind's blog.

  • Use package to get geo data from IP

const geoip = require('geo-from-ip')
console.log(geoip.allData('199.188.195.120'))
  • And the complete response will be returned
{
  "code": {
    "state": "CA",
    "country": "US",
    "registeredCountry": "US",
    "continent": "NA"
  },
  "geonameId": {
    "city": 5391959,
    "state": 5332921,
    "country": 6252001,
    "registeredCountry": 6252001,
    "continent": 6255149
  },
  "city": "San Francisco",
  "state": "California",
  "country": "United States",
  "registeredCountry": "United States",
  "continent": "North America",
  "postal": "94107",
  "location": {
    "accuracy_radius": 5,
    "latitude": 37.7642,
    "longitude": -122.3993,
    "metro_code": 807,
    "time_zone": "America/Los_Angeles"
  }
}
  • Update database

Database will get automatically updated every time deployment happens. But if you would like to force an update, just run:

npm install
# or, if you are using yarn
yarn

Remember that you will need to have MAXMIND_LICENSE_KEY set in your environment variables.

Debugging / Developing

Run your code using geo-from-ip as debug flag. Look into pacakge.json for example.

Credits

Database: Max-Mind

This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com

2.1.0

3 years ago

2.0.0

4 years ago

1.2.3

4 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.6

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago