ip2geolocation
v1.0.0
Published
Get geo location by IP
Downloads
2
Readme
IP 2 Geo Location
Install
$ npm install ip2geolocation
Usage Example
import { ipApi } from 'ip2geolocation';
fetch(ipApi.getUrl())
.then(res => res.json())
.then(data => console.log(ipApi.parseData(data)));
Data Providers
extremeIpLookUp
(see http://extreme-ip-lookup.com)freeGeoIp
(see https://freegeoip.app)ipApi
(see http://ip-api.com)ipApiCo
(see https://ipapi.co)ipInfo
(see https://ipinfo.io)
Every data provider uses its own data format. To use an unified data format (see a sample below)
{
"city" : "Mountain View",
"countryCode" : "US",
"lat" : 38.00881,
"lon" : -122.11746,
"ip" : "8.8.8.8"
}
use the parseData
method.