Skip to content

Repository files navigation

Maxmind reader


npm versionGitHub licenseCI pipelineOpened issuesOpened PRDeepScan gradeCode coverageDependencies

Purpose

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.

Compatibility

/!\ This module use async/await syntax, this is why you must have node 7.6+.

Supported and tested : >= 14

VersionSupportedTested
18.xyesyes
16.xyesyes
14.xyesyes
12.xnoyes
10.xnoyes
9.xnoyes
8.xnoyes
>= 7.6noyes

Installation

$ npm install @voodoo.io/maxmind-reader --save

Usage

Instantiation & init

constS3Tools=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()

Basic usage

constisoCode=geoloc.getCountry('149.62.156.82')// isoCode equals 'FR'

Config

Propertydescription Default value
S3_GEOLOC_KEY'/path/to/GeoLite2-Country.mmdb'empty
S3_GEOLOC_BUCKETBucket's nameempty
delayInterval in ms between two reloading3600000 (1hour)
enableSchedulerEnable the scheduler?true

Test

$ npm test

Coverage report can be found in coverage/.

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

12 watching

Forks

Releases

Packages

Used by

Contributors

Languages