Skip to content

Instantly share code, notes, and snippets.

@willscott
Last active August 29, 2015 14:16
Show Gist options
  • Save willscott/28737a2e236b010f8cd5 to your computer and use it in GitHub Desktop.
Save willscott/28737a2e236b010f8cd5 to your computer and use it in GitHub Desktop.
Create IP Lookup maps
var days = "01-03-2015 01-12-2015 01-19-2015 01-26-2015 02-02-2015 02-09-2015 02-16-2015 02-23-2015 07-10-2014 07-19-2014 07-27-2014 07-30-2014 08-08-2014 08-13-2014 08-17-2014 08-23-2014 08-31-2014 09-08-2014 09-13-2014 09-21-2014 09-25-2014 10-05-2014 10-13-2014 10-20-2014 10-31-2014 11-10-2014 11-13-2014 11-22-2014 11-26-2014 12-06-2014 12-13-2014 12-22-2014".split(" ");
var fs = require('fs');
var build = require('ip2country/src/build');
var doNext = function() {
var when = days.pop();
build.getGenericMap(false, false, when).then(function (map) {
fs.writeFileSync(when + '.lookup.json', JSON.stringify(map));
console.log('wrote ' + when);
fs.unlinkSync('rib');
}).then(function () {
if (days.length) {
process.nextTick(doNext);
}
});
}
doNext();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment