2.0.27 • Published 8 months ago

maxmind-geo-ip v2.0.27

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

Maxmind GeoLite2 database API for geolocating ip addresses

With automatic update of the GeoLite2 database

Usage example

import { IMaxMindOptions, startGeoIP } from 'maxmind-geo-ip';

export const maxMindOptions: IMaxMindOptions = {
  licenseKey: '-= license key =-', // https://support.maxmind.com/hc/en-us/sections/1260801610490-Manage-my-License-Keys
  maxItemsInCache: 10000, // https://www.npmjs.com/package/maxmind See "Options"
  updateSchedule: '0 0 * * 3,6', //  At 00:00 on Wednesday and Saturday. See https://support.maxmind.com/hc/en-us/articles/4408216129947
  dbDir: './mm-db' // Default: ./maxmind-db
};

const geoIp = await startGeoIP(maxMindOptions);
if (geoIp) {
  const result = geoIp.lookupEx('103.100.173.193', 'en');
  console.log(result)
}

expected result:

{
    continent: 'Asia',    
    continentCode: 'AS',  
    country: 'Indonesia',
    countryISOCode: 'ID',
    city: undefined,      
    latitude: -6.1728,    
    longitude: 106.8272,  
    postalCode: undefined,
    subdivision: undefined
}

Automatic update of the GeoLite2 database

To receive database updates, you need to obtain a maxmind license key.

Checking for a new version of the database and updating occurs according to the schedule specified in the updateSchedule parameter.
Default: 0 0 * * 3,6 - At 00:00 on Wednesday and Saturday

links:

2.0.27

8 months ago

2.0.26

8 months ago

2.0.25

8 months ago

2.0.24

8 months ago

2.0.23

8 months ago

2.0.22

8 months ago

2.0.21

8 months ago

2.0.20

8 months ago

2.0.18

8 months ago

2.0.17

8 months ago

2.0.16

8 months ago

2.0.14

8 months ago

2.0.13

8 months ago

2.0.11

8 months ago