Maxmind reader
Minimalist, efficient and performance focused module to read a maxmind database. Basically it can read a maxmind db from S3 and store it into memory.
/!\ This module use async/await syntax, this is why you must have node 7.6+.
Supported and tested : >= 14
| Version | Supported | Tested |
|---|---|---|
| 18.x | yes | yes |
| 16.x | yes | yes |
| 14.x | yes | yes |
| 12.x | no | yes |
| 10.x | no | yes |
| 9.x | no | yes |
| 8.x | no | yes |
| >= 7.6 | no | yes |
$ npm install @voodoo.io/maxmind-reader --saveconstS3Tools=require('@voodoo.io/aws-utils').s3consts3=newaws.S3()consts3Tools=newS3Tools(s3)constGeoloc=require('@voodoo.io/maxmind-reader')constgeoloc=newGeoloc({// here is your config},s3Tools)// launch the interval to reload the file// the delay can be customized as parameterawaitgeoloc.init()constisoCode=geoloc.getCountry('149.62.156.82')// isoCode equals 'FR'| Property | description | Default value |
|---|---|---|
S3_GEOLOC_KEY | '/path/to/GeoLite2-Country.mmdb' | empty |
S3_GEOLOC_BUCKET | Bucket's name | empty |
delay | Interval in ms between two reloading | 3600000 (1hour) |
enableScheduler | Enable the scheduler? | true |
$ npm testCoverage report can be found in coverage/.