maxmind-reload
Version:
Get maxmind paid and lite geoip data updates with exponential and custom retry2 strategies
80 lines (56 loc) • 3.12 kB
Markdown
# maxmind-reload [](https://npmjs.org/package/maxmind-reload) [](https://travis-ci.org/angleman/maxmind-reload/builds) [](https://gemnasium.com/angleman/maxmind-reload) [](#licensemit)
Get maxmind paid and lite geoip data updates with exponential and custom retry strategies
## Install
```
npm install maxmind-reload
```
## Usage
[maxmind-loader](https://github.com/angleman/maxmind-loader) compatible but with tenacity
```javascript
maxloader = require('maxmind-reload')
maxloader(function(err, filepath) { maxmind.init(filepath) }); // free geo data
```
## Example with defaults
```javascript
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
```
## Paid Geo Data Example
```javascript
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](https://github.com/angleman/maxmind-loader)
## License: MIT
<!--- :angleman@license-md/begin -->
Dependencies:
[](https://github.com/angleman/maxmind-loader)
Development Dependencies:
[](https://github.com/gruntjs/grunt)
[](https://github.com/vojtajina/grunt-bump)
[](https://github.com/angleman/license-md)
[](https://github.com/visionmedia/mocha)
[")](https://github.com/visionmedia/should.js)
<!--- :angleman@license-md/end -->