{"analyzedAt":"2022-06-30T13:04:43.062Z","collected":{"metadata":{"name":"mmdb-reader","scope":"unscoped","version":"1.2.0","description":"Read IP data from MaxMind DB files","keywords":["geoip","geoip2","maxmind","mmdb"],"date":"2018-07-02T14:23:48.738Z","author":{"name":"JT","email":"jt@gosquared.com","username":"jt"},"publisher":{"username":"jt","email":"jt@gosquared.com"},"maintainers":[{"username":"thedeveloper","email":"mail@geoffwagstaff.com"},{"username":"gosquared-admin","email":"support+npm@gosquared.com"},{"username":"jt","email":"jt@gosquared.com"}],"repository":{"type":"git","url":"git://github.com/gosquared/mmdb-reader.git"},"links":{"npm":"https://www.npmjs.com/package/mmdb-reader","homepage":"https://github.com/gosquared/mmdb-reader","repository":"https://github.com/gosquared/mmdb-reader","bugs":"https://github.com/gosquared/mmdb-reader/issues"},"license":"MIT","dependencies":{"big-integer":"^1.5.4","hashlru":"^2.0.0"},"devDependencies":{"eslint":"^1.10.3","mocha":"^2.2.5","sinon":"4.0.0"},"releases":[{"from":"2022-05-31T00:00:00.000Z","to":"2022-06-30T00:00:00.000Z","count":1},{"from":"2022-04-01T00:00:00.000Z","to":"2022-06-30T00:00:00.000Z","count":1},{"from":"2022-01-01T00:00:00.000Z","to":"2022-06-30T00:00:00.000Z","count":1},{"from":"2021-06-30T00:00:00.000Z","to":"2022-06-30T00:00:00.000Z","count":1},{"from":"2020-06-30T00:00:00.000Z","to":"2022-06-30T00:00:00.000Z","count":1}],"hasTestScript":true,"readme":"# mmdb-reader\n\n[![Travis](https://api.travis-ci.org/gosquared/mmdb-reader.svg)](https://travis-ci.org/gosquared/mmdb-reader)\n[![Dependencies](https://david-dm.org/gosquared/mmdb-reader.svg)](https://david-dm.org/gosquared/mmdb-reader)\n[![Join the chat at https://gitter.im/gosquared/mmdb-reader](https://img.shields.io/badge/gitter-join%20chat-blue.svg)](https://gitter.im/gosquared/mmdb-reader)\n\n[![NPM](https://nodei.co/npm/mmdb-reader.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/mmdb-reader)\n\nPure-JS reader for MaxMind DB (.mmdb) files, for looking up data indexed by IP address.\n\nInspired by [node-maxmind-db](https://github.com/PaddeK/node-maxmind-db), but faster.\n\n## Installation\n\n```sh\nnpm install mmdb-reader\n```\n\n## Usage\n\n```js\nvar MMDBReader = require('mmdb-reader');\n\n// Load synchronously\nvar reader = new MMDBReader('path/to/data.mmdb');\n\nreader.lookup('8.8.8.8'); // { city: { ... }, continent: { ... } }\n\n```\n\n### Async Loading\n\n```js\nvar MMDBReader = require('mmdb-reader');\n\nMMDBReader.open('path/to/data.mmdb', function(err, reader){\n\n  if(err){\n    // something went wrong. Handle it somehow\n  }\n\n  reader.lookup('8.8.8.8'); // { city: { ... }, continent: { ... } }\n\n});\n```\n\n\n## Assumptions\n\nmmdb-reader loads the entire database file into memory as a single node `Buffer`. It also uses an in-memory cache when reading complex data structures out of this buffer in the interests of performance. So very roughly speaking, you should assume this module will consume `size_of_mmdb_file * 1.25` of memory.\n\nThe default behaviour is to load the database file synchronously. This assumes that CPU and I/O are less important to you when your process is starting than when it's booted and you need to look up IPs quickly. If you want to load the file asynchronously then obviously you don't have a `reader` until it's finished.\n\nResults are returned directly from the in-memory cache by reference, so if you're going to be modifying data, you should copy it first. That is, don't do this:\n\n```js\nvar record = reader.lookup('1.2.3.4');\nrecord.something = 'foo';\n\n// elsewhere:\nvar anotherRecord = reader.lookup('2.3.4.5');\n// anotherRecord.something might be 'foo'. Or it might not. Who knows?\n```"},"npm":{"downloads":[{"from":"2022-06-29T00:00:00.000Z","to":"2022-06-30T00:00:00.000Z","count":516},{"from":"2022-06-23T00:00:00.000Z","to":"2022-06-30T00:00:00.000Z","count":3575},{"from":"2022-05-31T00:00:00.000Z","to":"2022-06-30T00:00:00.000Z","count":15485},{"from":"2022-04-01T00:00:00.000Z","to":"2022-06-30T00:00:00.000Z","count":40898},{"from":"2022-01-01T00:00:00.000Z","to":"2022-06-30T00:00:00.000Z","count":76853},{"from":"2021-06-30T00:00:00.000Z","to":"2022-06-30T00:00:00.000Z","count":149541}],"starsCount":3},"github":{"starsCount":41,"forksCount":6,"subscribersCount":7,"issues":{"count":18,"openCount":5,"distribution":{"3600":1,"10800":0,"32400":0,"97200":2,"291600":2,"874800":5,"2624400":2,"7873200":1,"23619600":0,"70858800":0,"212576400":5},"isDisabled":false},"contributors":[{"username":"chwagssd","commitsCount":5},{"username":"jbt","commitsCount":43}],"commits":[{"from":"2022-06-23T00:00:00.000Z","to":"2022-06-30T00:00:00.000Z","count":0},{"from":"2022-05-31T00:00:00.000Z","to":"2022-06-30T00:00:00.000Z","count":0},{"from":"2022-04-01T00:00:00.000Z","to":"2022-06-30T00:00:00.000Z","count":0},{"from":"2022-01-01T00:00:00.000Z","to":"2022-06-30T00:00:00.000Z","count":0},{"from":"2021-06-30T00:00:00.000Z","to":"2022-06-30T00:00:00.000Z","count":0}],"statuses":[{"context":"continuous-integration/travis-ci/push","state":"success"}]},"source":{"files":{"readmeSize":2248,"testsSize":274491,"hasNpmIgnore":true},"badges":[{"urls":{"original":"https://api.travis-ci.org/gosquared/mmdb-reader.svg","service":"https://api.travis-ci.org/gosquared/mmdb-reader.svg","shields":"https://img.shields.io/travis/gosquared/mmdb-reader.svg","content":"https://img.shields.io/travis/gosquared/mmdb-reader.json"},"info":{"service":"travis","type":"build"}},{"urls":{"original":"https://david-dm.org/gosquared/mmdb-reader.svg","service":"https://david-dm.org/gosquared/mmdb-reader.svg","shields":"https://img.shields.io/david/gosquared/mmdb-reader.svg","content":"https://img.shields.io/david/gosquared/mmdb-reader.json"},"info":{"service":"david","type":"dependencies","modifiers":{"statusType":"normal"}}},{"urls":{"original":"https://nodei.co/npm/mmdb-reader.png?downloadRank=true&downloads=true&stars=true","shields":"https://img.shields.io/npm/v/mmdb-reader.svg","content":"https://img.shields.io/npm/v/mmdb-reader.json"},"info":{"service":"npm","type":"version"}}],"linters":["editorconfig","eslint"]}},"evaluation":{"quality":{"carefulness":0.9199999999999999,"tests":0.85,"health":1,"branding":0.44999999999999996},"popularity":{"communityInterest":59,"downloadsCount":13632.666666666666,"downloadsAcceleration":30.931259512937572,"dependentsCount":0},"maintenance":{"releasesFrequency":0.9,"commitsFrequency":0.9,"openIssues":0.9,"issuesDistribution":0.9}},"score":{"final":0.6814320138704058,"detail":{"quality":0.968987799345873,"popularity":0.11650680623274276,"maintenance":0.9998808339576686}}}