IP lookup using Maxmind databases
npm i maxmind
var maxmind = ;maxmind;maxmind;// Be careful with sync version! Since mmdb files// are quite large (city database is about 100Mb)// `fs.readFileSync` blocks whole process while it// reads file into buffer.var cityLookup = maxmind;var city = cityLookup;var orgLookup = maxmind;var organization = orgLookup;
Module is fully campatible with IPv6. There are no differences in API between IPv4 and IPv6.
var lookup = maxmind;var location = maxmind;
Right now the only option you can configure is cache. Module uses lru-cache. You can configure its settings by doing following:
var lookup = maxmindlookup;
Module supports validation for both IPv4 and IPv6:
maxmind; // returns truemaxmind; // returns falsemaxmind; // returns truemaxmind; // returns false
In case you want to use legacy GeoIP binary databases you should use email@example.com.