1.0.12 • Published 1 year ago

@voodoo.io/maxmind-reader v1.0.12

Weekly downloads
270
License
MIT
Repository
github
Last release
1 year ago

npm version GitHub license CI pipeline Opened issues Opened PR DeepScan grade Code coverage Dependencies

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

const S3Tools = require('@voodoo.io/aws-utils').s3
const s3 = new aws.S3()
const s3Tools = new S3Tools(s3)

const Geoloc = require('@voodoo.io/maxmind-reader')
const geoloc = new Geoloc({
  // here is your config
}, s3Tools)

// launch the interval to reload the file
// the delay can be customized as parameter
await geoloc.init()

Basic usage

const isoCode = 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/.

1.0.12

1 year ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago