Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/a-tokyo/micro-geoip-lite-js
🌍 An extremely lite geoip decoder utilizing the micro-geoip-lite microservice to geo decode the IP info via an https request - the microservice utilizes MaxMind's IP info dataset.
https://github.com/a-tokyo/micro-geoip-lite-js
country decode flow flow-typed free geocoding geoip geoip-lite geolocation ip lite-weight maxmind types typescripe
Last synced: 2 months ago
JSON representation
🌍 An extremely lite geoip decoder utilizing the micro-geoip-lite microservice to geo decode the IP info via an https request - the microservice utilizes MaxMind's IP info dataset.
- Host: GitHub
- URL: https://github.com/a-tokyo/micro-geoip-lite-js
- Owner: a-tokyo
- License: mit
- Created: 2020-04-07T22:31:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-17T17:21:58.000Z (5 months ago)
- Last Synced: 2024-10-20T15:40:46.654Z (2 months ago)
- Topics: country, decode, flow, flow-typed, free, geocoding, geoip, geoip-lite, geolocation, ip, lite-weight, maxmind, types, typescripe
- Language: JavaScript
- Homepage: https://geoip-lite.now.sh
- Size: 308 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# micro-geoip-lite
🌍 An extremely lite geoip decoder utilizing the [micro-geoip-lite microservice](https://github.com/A-Tokyo/micro-geoip-lite) to geo decode the IP info via an https request - the microservice utilizes MaxMind's IP info dataset.
# Installation
- Run `yarn add micro-geoip-lite`, `npm i micro-geoip-lite`# Usage
- params:
- ip?: string - optional, defaults to client's IP
- options?:
```js
{
serviceUrl?: string, // called instead of the default provider URL. You can also provide this via an env var `REACT_APP_SERVICE_URL_GEOIP` or `SERVICE_URL_GEOIP`
timeout?: string, // timeout in ms
}
```
- returns:
```js
{
ip: string, // if ip param was not provided, this defaults to request.ip
range: [ number, number ],
country: string,
region: string,
eu: string, // '0' or '1'
timezone: string,
city: string,
ll: [ number, number ],
metro: number,
area: number,
// error: 'Error text', // only exists if an error happened
}
```- example - fetch own ip info:
```js
import geodecodeIp from 'micro-geoip-lite';
const result = await geodecodeIp();{
ip: '207.97.227.239', // if ip param was not provided, this defaults to request.ip
range: [ 3479298048, 3479300095 ],
country: 'US',
region: 'TX',
eu: '0',
timezone: 'America/Chicago',
city: 'San Antonio',
ll: [ 29.4969, -98.4032 ],
metro: 641,
area: 1000,
// error: 'Error text', // only exists if an error happened
}
```- example - fetch specific ip info:
```js
import geodecodeIp from 'micro-geoip-lite';
const result = await geodecodeIp('207.97.227.239');
```- [Live DEMO](https://geoip-lite.vercel.app/?ip=207.97.227.239)