maxmind-reload

Get maxmind paid and lite geoip data updates with exponential and custom retry2 strategies

npm install maxmind-reload
10 downloads in the last week
20 downloads in the last month

maxmind-reload NPM version Build Status Dependency Status License

Get maxmind paid and lite geoip data updates with exponential and custom retry strategies

Install

npm install maxmind-reload

Usage

maxmind-loader compatible but with tenacity

maxloader = require('maxmind-reload')
maxloader(function(err, filepath) { maxmind.init(filepath) }); // free geo data

Example with defaults

maxmind   = require('maxmind')
maxloader = require('maxmind-reload')

maxloader({
    license: undefined,  // 'maxmind license' for paid data otherwise free version used
    retries: 5,
    pause:   5 * 1000,   // 5 seconds
    silent:  false,      // true = don't console.log attempts
    random:  10,         // 10%, add random amount up to 'random' percentage of pause
    dest:    '/tmp/'     // default load free /tmp/GeoCityLite.dat
}, function (err, filepath) {
    maxmind.init(filepath);
});

Sample factors

pause  factor  retry 2    3         4          5           6        7        8   9    10   11      12        13        14
5s     2       5s,   10s, 20s,      40s,       80s~1m,     160s=2m, 320s=4m, 8m, 16m, 32m, 64m=~1h, 128m=~2h, 256m=~4h, 512m=~8h
5s     5       5s,   25s, 125s=~2m, 625s=~10m, 3125s=~52m
var options = { license: 'MAXMIND_LICENSE' };

maxloader(options, function(err, filepath) {
    if (err) {
        console.log(err);
    } else {
        maxmind.init(filepath, { memoryCache: true });
    }
})

For additional parameter details see: maxmind-loader

License: MIT

Dependencies: maxmind-loader Development Dependencies: grunt grunt-bump license-md mocha should
npm loves you