{"analyzedAt":"2022-10-07T06:41:25.577Z","collected":{"metadata":{"name":"maxmind","scope":"unscoped","version":"4.3.8","description":"IP lookup using Maxmind databases","keywords":["maxmind","mmdb","geo","geoip","geoip2","geobase","geo lookup","ip base","geocode","timezone","asn","geo lookup","ip lookup"],"date":"2022-10-06T01:40:12.327Z","author":{"name":"Dmitry Shirokov","email":"deadrunk@gmail.com","username":"runk"},"publisher":{"username":"runk","email":"deadrunk@gmail.com"},"maintainers":[{"username":"runk","email":"deadrunk@gmail.com"}],"contributors":[{"name":"Thomas Birke @quafzi","email":"quafzi@netextreme.de"},{"name":"Afzaal Ameer @afzaalace"},{"name":"Andrew N Golovkov @AndorCS"},{"name":"Gregory Oschwald @oschwald"}],"repository":{"type":"git","url":"git+https://github.com/runk/node-maxmind.git"},"links":{"npm":"https://www.npmjs.com/package/maxmind","homepage":"https://github.com/runk/node-maxmind","repository":"https://github.com/runk/node-maxmind","bugs":"http://github.com/runk/node-maxmind/issues"},"license":"MIT","dependencies":{"mmdb-lib":"2.0.2","tiny-lru":"9.0.3"},"devDependencies":{"@types/ip6addr":"0.2.3","@types/jest":"28.1.8","@types/netmask":"1.0.30","@types/node":"16.11.64","@types/sinon":"10.0.13","ip-address":"8.1.0","ip6addr":"0.2.5","jest":"28.1.3","prettier":"2.7.1","semantic-release":"19.0.5","sinon":"14.0.1","ts-jest":"28.0.8","typescript":"4.8.4"},"releases":[{"from":"2022-09-07T00:00:00.000Z","to":"2022-10-07T00:00:00.000Z","count":3},{"from":"2022-07-09T00:00:00.000Z","to":"2022-10-07T00:00:00.000Z","count":3},{"from":"2022-04-10T00:00:00.000Z","to":"2022-10-07T00:00:00.000Z","count":3},{"from":"2021-10-07T00:00:00.000Z","to":"2022-10-07T00:00:00.000Z","count":7},{"from":"2020-10-07T00:00:00.000Z","to":"2022-10-07T00:00:00.000Z","count":9}],"hasTestScript":true,"hasSelectiveFiles":true,"readme":"# node-maxmind\n\nJavascript module for Geo IP lookup using Maxmind binary databases (aka mmdb or geoip2).\nFastest Maxmind lookup library available - up to [17,000% faster](https://github.com/runk/node-maxmind-benchmark) 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 using other formats.\n\n## GEO databases\n\nYou might want to use [geolite2](https://github.com/runk/node-geolite2) module with free geo databases. Alternatively, free databases available for [download here](http://dev.maxmind.com/geoip/geoip2/geolite2/). If you need better accuracy you should consider buying [commercial subscription](https://www.maxmind.com/en/geoip2-databases).\n\n## Installation\n\n```shell\nnpm i maxmind\n```\n\n## Usage\n\n```typescript\nimport maxmind, { CityResponse } from 'maxmind';\n\nconst lookup = await maxmind.open<CityResponse>('/path/to/GeoLite2-City.mmdb');\nconsole.log(lookup.get('66.6.44.4')); // inferred type maxmind.CityResponse\n\nconsole.log(lookup.getWithPrefixLength('66.6.44.4')); // tuple with inferred type [maxmind.CityResponse|null, number]\n```\n\n### Sync API\n\nYou can use `Reader` class directly in case if you would want to instantiate it in non-async fashion. Use cases would include receiving a buffer database over network, or just reading it synchronously from disk.\n\n```typescript\nimport { Reader } from 'maxmind';\nconst buffer = fs.readFileSync('./db.mmdb');\nconst lookup = new Reader<CityResponse>(buffer);\nconst city = lookup.get('8.8.8.8');\n\nconst [city2, prefixLength] = lookup.getWithPrefixLength('66.6.44.4');\n```\n\nSupported response types:\n\n```\n- CountryResponse\n- CityResponse\n- AnonymousIPResponse\n- AsnResponse\n- ConnectionTypeResponse\n- DomainResponse\n- IspResponse\n```\n\n## IPv6 Support\n\nModule is fully compatible with IPv6. There are no differences in API between IPv4 and IPv6.\n\n```javascript\nconst lookup = await maxmind.open('/path/to/GeoLite2.mmdb');\nconst location = lookup.get('2001:4860:0:1001::3004:ef68');\n```\n\n## Options\n\n_maxmind.open(filepath, [options])_\n\n- `filepath`: `<string>` Path to the binary mmdb database file.\n- `options`: `<Object>`\n  - `cache`: `<Object>` Cache options. Under the bonnet module uses [tiny-lru](https://github.com/avoidwork/tiny-lru) cache.\n    - `max`: `<number>` Max cache items to keep in memory. _Default_: `6000`.\n  - `watchForUpdates`: `<boolean>` Supports reloading the reader when changes occur to the database that is loaded. _Default_: `false`.\n  - `watchForUpdatesNonPersistent`: `<boolean>` Controlls wether the watcher should be persistent or not. If it is persistent, a node process will be blocked in watching state if the watcher is the only thing still running in the program. _Default_: `false`.\n  - `watchForUpdatesHook`: `<Function>` Hook function that is fired on database update. _Default_: `null`.\n\n## Does it work in browser?\n\nCurrent module is designed to work in node.js environment. Check out [mmdb-lib](https://github.com/runk/mmdb-lib) that's used under the bonnet - it's environment agnostic and does work in browser.\n\n## IP addresses validation\n\nModule supports validation for both IPv4 and IPv6:\n\n```javascript\nmaxmind.validate('66.6.44.4'); // returns true\nmaxmind.validate('66.6.44.boom!'); // returns false\n\nmaxmind.validate('2001:4860:0:1001::3004:ef68'); // returns true\nmaxmind.validate('2001:4860:0:1001::3004:boom!'); // returns false\n```\n\n## GeoIP Legacy binary format\n\nIn case you want to use legacy GeoIP binary databases you should use [maxmind@0.6](https://github.com/runk/node-maxmind/releases/tag/v0.6.0).\n\n## References\n\n- [MMDB library](https://github.com/runk/mmdb-lib)\n- MaxMind DB file format specification http://maxmind.github.io/MaxMind-DB/\n- MaxMind test/sample DB files https://github.com/maxmind/MaxMind-DB\n- GeoLite2 Free Downloadable Databases http://dev.maxmind.com/geoip/geoip2/geolite2/\n- Great talk about V8 performance https://www.youtube.com/watch?v=UJPdhx5zTaw\n- V8 Optimization killers https://github.com/petkaantonov/bluebird/wiki/Optimization-killers\n- More V8 performance tips http://www.html5rocks.com/en/tutorials/speed/v8/\n\n## License\n\nMIT"},"npm":{"downloads":[{"from":"2022-10-06T00:00:00.000Z","to":"2022-10-07T00:00:00.000Z","count":27458},{"from":"2022-09-30T00:00:00.000Z","to":"2022-10-07T00:00:00.000Z","count":142288},{"from":"2022-09-07T00:00:00.000Z","to":"2022-10-07T00:00:00.000Z","count":617393},{"from":"2022-07-09T00:00:00.000Z","to":"2022-10-07T00:00:00.000Z","count":1813736},{"from":"2022-04-10T00:00:00.000Z","to":"2022-10-07T00:00:00.000Z","count":3739505},{"from":"2021-10-07T00:00:00.000Z","to":"2022-10-07T00:00:00.000Z","count":7011407}],"starsCount":17},"github":{"starsCount":538,"forksCount":65,"subscribersCount":17,"issues":{"count":577,"openCount":2,"distribution":{"3600":86,"10800":27,"32400":75,"97200":81,"291600":86,"874800":76,"2624400":73,"7873200":43,"23619600":18,"70858800":10,"212576400":2},"isDisabled":false},"contributors":[{"username":"renovate-bot","commitsCount":345},{"username":"runk","commitsCount":237},{"username":"renovate[bot]","commitsCount":178},{"username":"kevcenteno","commitsCount":17},{"username":"oschwald","commitsCount":9},{"username":"dependabot[bot]","commitsCount":7},{"username":"greenkeeper[bot]","commitsCount":3},{"username":"quafzi","commitsCount":2},{"username":"belev","commitsCount":2},{"username":"AndorCS","commitsCount":2},{"username":"knoxcard","commitsCount":2},{"username":"rishabhbits038","commitsCount":2},{"username":"msimerson","commitsCount":1},{"username":"nicjohnson","commitsCount":1},{"username":"jonathanong","commitsCount":1},{"username":"id0Sch","commitsCount":1},{"username":"evanlucas","commitsCount":1},{"username":"rwky","commitsCount":1},{"username":"furanzujin","commitsCount":1},{"username":"charles-logdirect","commitsCount":1},{"username":"kpdecker","commitsCount":1},{"username":"horgh","commitsCount":1},{"username":"andrewkarell","commitsCount":1}],"commits":[{"from":"2022-09-30T00:00:00.000Z","to":"2022-10-07T00:00:00.000Z","count":12},{"from":"2022-09-07T00:00:00.000Z","to":"2022-10-07T00:00:00.000Z","count":12},{"from":"2022-07-09T00:00:00.000Z","to":"2022-10-07T00:00:00.000Z","count":17},{"from":"2022-04-10T00:00:00.000Z","to":"2022-10-07T00:00:00.000Z","count":29},{"from":"2021-10-07T00:00:00.000Z","to":"2022-10-07T00:00:00.000Z","count":77}]},"source":{"files":{"readmeSize":4347,"testsSize":33579,"hasNpmIgnore":true},"linters":["prettier","tslint"]}},"evaluation":{"quality":{"carefulness":0.9199999999999999,"tests":0.6,"health":1,"branding":0},"popularity":{"communityInterest":660,"downloadsCount":604578.6666666666,"downloadsAcceleration":734.0314878234403,"dependentsCount":0},"maintenance":{"releasesFrequency":1,"commitsFrequency":0.9528150684931507,"openIssues":1,"issuesDistribution":0.9}},"score":{"final":0.7117431620033375,"detail":{"quality":0.8364556389013833,"popularity":0.3166288307351501,"maintenance":0.9999610845017715}}}