UNPKG

4.35 kBMarkdownView Raw
1# Maxmind Databases
2
3> Maxmind / Geolite2 databases for [node-maxmind](https://github.com/runk/node-maxmind)
4
5[![CircleCI](https://circleci.com/gh/pi0/maxmind-databases.svg?style=svg)](https://circleci.com/gh/pi0/maxmind-databases)
6
7## Packages
8
9All packages will be auto updated and published every monday.
10
11Package | Latest | Size
12--------|---------|---------
13[maxmind-country](https://www.npmjs.com/package/maxmind-country) | [![npm version](https://badge.fury.io/js/maxmind-country.svg)](https://badge.fury.io/js/maxmind-country) | [![install size](https://packagephobia.now.sh/badge?p=maxmind-country)](https://packagephobia.now.sh/result?p=maxmind-country)
14[maxmind-asn](https://www.npmjs.com/package/maxmind-asn)| [![npm version](https://badge.fury.io/js/maxmind-asn.svg)](https://badge.fury.io/js/maxmind-asn) | [![install size](https://packagephobia.now.sh/badge?p=maxmind-asn)](https://packagephobia.now.sh/result?p=maxmind-asn)
15[maxmind-city](https://www.npmjs.com/package/maxmind-city) | [![npm version](https://badge.fury.io/js/maxmind-city.svg)](https://badge.fury.io/js/maxmind-city) | [![install size](https://packagephobia.now.sh/badge?p=maxmind-city)](https://packagephobia.now.sh/result?p=maxmind-city)
16
17
18## Usage
19
20Require maxmind:
21
22```js
23const maxmind = require('maxmind')
24```
25
26Load either `max-city`, `max-country` or `max-asn` packages:
27
28```js
29// City Lookup
30const lookupCity = maxmind.openSync(require('maxmind-city'))
31const city = lookupCity.get('8.8.8.8')
32
33// Country Lookup
34const lookupCountry = maxmind.openSync(require('maxmind-country'))
35const country = lookupCountry.get('8.8.8.8')
36
37// ASN Lookup
38const lookupASN = maxmind.openSync(require('maxmind-asn'))
39const asn = lookupASN.get('8.8.8.8')
40```
41
42## Example results
43
44**ASN**
45
46```json
47{
48 "autonomous_system_number": 15169,
49 "autonomous_system_organization": "Google LLC"
50}
51```
52
53**Country**
54
55```json
56{
57 "continent": {
58 "code": "NA",
59 "geoname_id": 6255149,
60 "names": {
61 "de": "Nordamerika",
62 "en": "North America",
63 "es": "Norteamérica",
64 "fr": "Amérique du Nord",
65 "ja": "北アメリカ",
66 "pt-BR": "América do Norte",
67 "ru": "Северная Америка",
68 "zh-CN": "北美洲"
69 }
70 },
71 "country": {
72 "geoname_id": 6252001,
73 "iso_code": "US",
74 "names": {
75 "de": "USA",
76 "en": "United States",
77 "es": "Estados Unidos",
78 "fr": "États-Unis",
79 "ja": "アメリカ合衆国",
80 "pt-BR": "Estados Unidos",
81 "ru": "США",
82 "zh-CN": "美国"
83 }
84 },
85 "registered_country": {
86 "geoname_id": 6252001,
87 "iso_code": "US",
88 "names": {
89 "de": "USA",
90 "en": "United States",
91 "es": "Estados Unidos",
92 "fr": "États-Unis",
93 "ja": "アメリカ合衆国",
94 "pt-BR": "Estados Unidos",
95 "ru": "США",
96 "zh-CN": "美国"
97 }
98 }
99}
100```
101
102**City**
103
104**NOTE:** Latitude and longitude are not precise and should not be used to identify a particular street address or household.
105
106```json
107{
108 "continent": {
109 "code": "NA",
110 "geoname_id": 6255149,
111 "names": {
112 "de": "Nordamerika",
113 "en": "North America",
114 "es": "Norteamérica",
115 "fr": "Amérique du Nord",
116 "ja": "北アメリカ",
117 "pt-BR": "América do Norte",
118 "ru": "Северная Америка",
119 "zh-CN": "北美洲"
120 }
121 },
122 "country": {
123 "geoname_id": 6252001,
124 "iso_code": "US",
125 "names": {
126 "de": "USA",
127 "en": "United States",
128 "es": "Estados Unidos",
129 "fr": "États-Unis",
130 "ja": "アメリカ合衆国",
131 "pt-BR": "Estados Unidos",
132 "ru": "США",
133 "zh-CN": "美国"
134 }
135 },
136 "location": {
137 "accuracy_radius": 1000,
138 "latitude": 37.751,
139 "longitude": -97.822
140 },
141 "registered_country": {
142 "geoname_id": 6252001,
143 "iso_code": "US",
144 "names": {
145 "de": "USA",
146 "en": "United States",
147 "es": "Estados Unidos",
148 "fr": "États-Unis",
149 "ja": "アメリカ合衆国",
150 "pt-BR": "Estados Unidos",
151 "ru": "США",
152 "zh-CN": "美国"
153 }
154 }
155}
156```
157
158## Development
159
160Run `./scripts/fetch` and `./scripts/update` to fetch latest databases.
161
162## License
163
164This product includes GeoLite2 data created by MaxMind, available from [http://www.maxmind.com](http://www.maxmind.com)
165
166Packages published under MIT