![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Pure Javascript module for Geo IP lookup using Maxmind binary databases (aka mmdb or geoip2). Fastest Maxmind lookup library available - up to 8000% faster than other libraries. Module has 100% test coverage with comprehensive test suite. It natively works with binary Maxmind database format and doesn't require any "CSV - {specific lib format}" conversions as some other modules do. Maxmind binary databases are highly optimized for size and performance so there's no point working with other than that format.
Free GEO databases are available for download here. If you need better accuracy you should consider buying commercial subscription.
npm i maxmind
var maxmind = require('maxmind');
maxmind.open('/path/to/GeoLite2-City.mmdb', (err, cityLookup) => {
var city = cityLookup.get('66.6.44.4');
});
maxmind.open('/path/to/GeoOrg.mmdb', (err, orgLookup) => {
var city = orgLookup.get('66.6.44.4');
});
// 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.openSync('/path/to/GeoLite2-City.mmdb');
var city = cityLookup.get('66.6.44.4');
var orgLookup = maxmind.openSync('/path/to/GeoOrg.mmdb');
var organization = orgLookup.get('66.6.44.4');
Module is fully campatible with IPv6. There are no differences in API between IPv4 and IPv6.
var lookup = maxmind.openSync('/path/to/GeoLite2.mmdb');
var location = maxmind.get('2001:4860:0:1001::3004:ef68');
Right now the only option you can configure is cache. Module uses lru-cache. You can configure its settings by doing following:
var lookup = maxmind.openSync('/path/to/GeoLite2.mmdb', {
cache: {
max: 1000, // max items in cache
maxAge: 1000 * 60 * 60 // life time in milliseconds
}
})
lookup.get('1.1.1.1');
Module supports validation for both IPv4 and IPv6:
maxmind.validate('66.6.44.4'); // returns true
maxmind.validate('66.6.44.boom!'); // returns false
maxmind.validate('2001:4860:0:1001::3004:ef68'); // returns true
maxmind.validate('2001:4860:0:1001::3004:boom!'); // returns false
In case you want to use legacy GeoIP binary databases you should use maxmind@0.6.
MIT
FAQs
IP lookup using Maxmind databases
The npm package maxmind receives a total of 178,226 weekly downloads. As such, maxmind popularity was classified as popular.
We found that maxmind demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.