Giter Site home page Giter Site logo

seymurg / geo-from-ip Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vikramtiwari/geo-from-ip

0.0 0.0 0.0 30.42 MB

Get geolocation ๐ŸŒ information about an IP ๐Ÿ“ฒ

Home Page: https://vikramtiwari.github.io/geo-from-ip/

License: MIT License

JavaScript 100.00%

geo-from-ip's Introduction

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

geo-from-ip's People

Contributors

vikramtiwari avatar greenkeeper[bot] avatar greenkeeperio-bot avatar appelgriebsch avatar ratnadeep007 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.