Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@voodoo.io/maxmind-reader

Package Overview
Dependencies
Maintainers
5
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@voodoo.io/maxmind-reader

Simple module to read a maxmind db from S3 a keep it into memory! You can also retrieve the file periodically.

  • 1.0.12
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source
Maxmind reader


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/.

Keywords

FAQs

Package last updated on 27 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc