{"analyzedAt":"2022-07-09T21:10:43.778Z","collected":{"metadata":{"name":"geoip2ws","scope":"unscoped","version":"2.0.3","description":"Maxmind GeoIP2 Web Services (unofficial) - IP and hostname geolocation","keywords":["api","geoip","geoip2","geolocation","geolookup","hostname","ip","location","lookup","maxmind","network"],"date":"2022-03-15T20:43:49.253Z","author":{"name":"Franklin","email":"info@fvdm.com","url":"https://fvdm.com","username":"franklin"},"publisher":{"username":"franklin","email":"info@fvdm.com"},"maintainers":[{"username":"franklin","email":"info@fvdm.com"}],"repository":{"type":"git","url":"git://github.com/fvdm/nodejs-geoip2ws.git"},"links":{"npm":"https://www.npmjs.com/package/geoip2ws","homepage":"https://github.com/fvdm/nodejs-geoip2ws#readme","repository":"https://github.com/fvdm/nodejs-geoip2ws","bugs":"https://github.com/fvdm/nodejs-geoip2ws/issues"},"license":"Unlicense","dependencies":{"httpreq":"^0.5.2"},"devDependencies":{"dotest":"^2.12.1"},"releases":[{"from":"2022-06-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":1},{"from":"2022-04-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":1},{"from":"2022-01-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":2},{"from":"2021-07-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":5},{"from":"2020-07-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":6}],"hasTestScript":true,"hasSelectiveFiles":true,"readme":"# geoip2ws\n\nUnofficial Node.js module for the Maxmind GeoIP2\nWeb Services.\n\n[![npm](https://img.shields.io/npm/v/geoip2ws.svg?maxAge=3600)](https://www.npmjs.com/package/geoip2ws?activeTab=versions)\n[![Build Status](https://github.com/fvdm/nodejs-geoip2ws/actions/workflows/node.js.yml/badge.svg?branch=master)](https://github.com/fvdm/nodejs-geoip2ws/actions/workflows/node.js.yml)\n[![Coverage Status](https://coveralls.io/repos/github/fvdm/nodejs-geoip2ws/badge.svg?branch=master)](https://coveralls.io/github/fvdm/nodejs-geoip2ws?branch=master)\n\n* [Changelog](https://github.com/fvdm/nodejs-geoip2ws/blob/master/CHANGELOG.md)\n* [Node.js](https://nodejs.org)\n* [Maxmind GeoIP2 Web Services](https://www.maxmind.com/en/geoip2-precision-services)\n* [API documentation](https://dev.maxmind.com/geoip/docs/web-services)\n\n\n## Usage\n\nYou can provide the configuration in the require function\nor inline at lookup time. The lookup always returns a Promise.\n\n- [Response examples](https://dev.maxmind.com/geoip/docs/web-services/responses?lang=en#bodies)\n- [List of API errors](https://dev.maxmind.com/geoip/docs/web-services/responses?lang=en#errors)\n\n\n### Normal configuration\n\n```js\nconst geo = require ('geoip2ws') ({\n  userId: '12345',\n  licenseKey: 'abc678',\n});\n\ngeo ({\n  service: 'city',\n  ip: '1.2.3.4',\n})\n  .then (console.log)\n  .catch (console.error)\n;\n```\n\n\n### Inline configuration\n\n```js\nconst geo = require ('geoip2ws')();\n\ngeo ({\n  userId: '12345',\n  licenseKey: 'abc678',\n  service: 'city',\n  ip: '1.2.3.4',\n})\n  .then (console.log)\n  .catch (console.error)\n;\n```\n\n\n## Installation\n\nYou need a Maxmind account ID and license key with enough\ncredits for one of their GeoIP *web* services.\nYou can find both [*here*](https://www.maxmind.com/en/accounts/current/license-key).\n\n`npm i geoip2ws`\n\n\n## The functions\n\n### Setup\n\nThe _first function_ is the global config and returns the\nlookup function. It takes these settings:\n\nparameter        | type    | default                   | description\n:----------------|:--------|:--------------------------|:-----------\n[userId]         | string  |                           | User ID\n[licenseKey]     | string  |                           | License key\n[service]        | string  | city                      | `insights`, `country` or `city`\n[endpoint]       | string  | https://geoip.maxmind.com | Override endpoint hostname or url\n[requestTimeout] | integer | 5000                      | Request timeout in ms\n\n```js\nconst geo = require ('geoip2ws') ({\n  userId: '1234',\n  licenseKey: 'abc',\n  service: 'country',\n  requestTimeout: 2000\n});\n```\n\nIf you are providing the details in the lookup\nfunction, then you don't have to set them here but\nyou do need to run this setup function once.\n\n```js\nconst geo = require ('geoip2ws')();\n```\n\n\n### Lookup\n\nThe _second function_ does the IP-address lookup and\ntakes `ip` and optionally the same settings as above.\n\nparameter  | type     | description\n:----------|:---------|:-----------\nip         | string   | The IPv4 or IPv6 address to lookup\n\n```js\ngeo ({\n  ip: '1.2.3.4',\n  service: 'city',\n  endpoint: 'geoip-eu-west.maxmind.com',\n})\n  .then (processData)\n  .catch (console.error)\n;\n```\n\n\n#### Errors\n\nerror message   | description\n:---------------|:-----------\ninvalid service | The service name is invalid\ninvalid ip      | The IP-address is invalid\n\nThese two conditions are checked before sending\nthe request. Meaning it won't cost you account credits.\n\n\n## Unlicense\n\nThis is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or\ndistribute this software, either in source code form or as a compiled\nbinary, for any purpose, commercial or non-commercial, and by any\nmeans.\n\nIn jurisdictions that recognize copyright laws, the author or authors\nof this software dedicate any and all copyright interest in the\nsoftware to the public domain. We make this dedication for the benefit\nof the public at large and to the detriment of our heirs and\nsuccessors. We intend this dedication to be an overt act of\nrelinquishment in perpetuity of all present and future rights to this\nsoftware under copyright law.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\nFor more information, please refer to <https://unlicense.org/>\n\n\n## Author\n\n[Franklin](https://fvdm.com)\n| [Buy me a coffee](https://fvdm.com/donating/)"},"npm":{"downloads":[{"from":"2022-07-08T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":3198},{"from":"2022-07-02T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":14636},{"from":"2022-06-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":52268},{"from":"2022-04-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":129872},{"from":"2022-01-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":279317},{"from":"2021-07-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":500654}],"starsCount":3},"github":{"homepage":"https://www.npmjs.com/package/geoip2ws","starsCount":47,"forksCount":5,"subscribersCount":5,"issues":{"count":52,"openCount":0,"distribution":{"3600":22,"10800":5,"32400":4,"97200":2,"291600":4,"874800":4,"2624400":1,"7873200":6,"23619600":3,"70858800":1,"212576400":0},"isDisabled":false},"contributors":[{"username":"greenkeeper[bot]","commitsCount":2},{"username":"fvdm","commitsCount":434},{"username":"greenkeeperio-bot","commitsCount":4},{"username":"dependabot[bot]","commitsCount":11}],"commits":[{"from":"2022-07-02T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":0},{"from":"2022-06-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":0},{"from":"2022-04-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":1},{"from":"2022-01-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":15},{"from":"2021-07-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":39}],"statuses":[{"context":"coverage/coveralls","state":"success"},{"context":"Coveralls - node-12","state":"success"},{"context":"Coveralls - node-17","state":"success"},{"context":"Coveralls - node-16","state":"success"},{"context":"Coveralls - node-14","state":"success"}]},"source":{"files":{"readmeSize":4779,"testsSize":6328,"hasChangelog":true},"badges":[{"urls":{"original":"https://img.shields.io/npm/v/geoip2ws.svg?maxAge=3600","shields":"https://img.shields.io/npm/v/geoip2ws.svg","content":"https://img.shields.io/npm/v/geoip2ws.json"},"info":{"service":"npm","type":"version","modifiers":{"type":"v"}}},{"urls":{"original":"https://coveralls.io/repos/github/fvdm/nodejs-geoip2ws/badge.svg?branch=master","service":"https://coveralls.io/repos/github/fvdm/nodejs-geoip2ws/badge.svg?branch=master","shields":"https://img.shields.io/coveralls/fvdm/nodejs-geoip2ws/master.svg","content":"https://img.shields.io/coveralls/fvdm/nodejs-geoip2ws/master.json"},"info":{"service":"coveralls","type":"coverage","modifiers":{"branch":"master"}}}],"linters":["editorconfig","eslint"],"coverage":1}},"evaluation":{"quality":{"carefulness":0.9999999999999999,"tests":1,"health":1,"branding":0.3},"popularity":{"communityInterest":64,"downloadsCount":43290.666666666664,"downloadsAcceleration":137.67954718417047,"dependentsCount":0},"maintenance":{"releasesFrequency":0.9,"commitsFrequency":0.9,"openIssues":1,"issuesDistribution":0.9}},"score":{"final":0.6960343320650896,"detail":{"quality":0.9953905442444503,"popularity":0.13557124181178332,"maintenance":0.9999063833075152}}}