@maxminddatabase/geolite2 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/database/GeoLite2-ASN.mmdb +0 -0
- package/database/GeoLite2-City.mmdb +0 -0
- package/database/GeoLite2-Country.mmdb +0 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @MaxMindDatabase/GeoLite2
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE3D,qBAAa,QAAQ;IACnB,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,QAAQ,CAAS;gBAEb,QAAQ,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS;IAKhD,IAAI,MAAM,IAAI,WAAW,CAWxB;CACF"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { readFileSync } from "fs";
|
|
2
|
+
import { dirname, resolve } from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { Reader, ReaderModel } from "@maxmind/geoip2-node";
|
|
5
|
+
export class GeoLite2 {
|
|
6
|
+
_reader;
|
|
7
|
+
database;
|
|
8
|
+
constructor(database) {
|
|
9
|
+
this.database = database;
|
|
10
|
+
this._reader = null;
|
|
11
|
+
}
|
|
12
|
+
get reader() {
|
|
13
|
+
if (!this._reader) {
|
|
14
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
const dbPath = resolve(__dirname, `../database/GeoLite2-${this.database}.mmdb`);
|
|
16
|
+
const dbBuffer = readFileSync(dbPath);
|
|
17
|
+
this._reader = Reader.openBuffer(dbBuffer);
|
|
18
|
+
}
|
|
19
|
+
return this._reader;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,OAAO,QAAQ;IACX,OAAO,CAAqB;IAC5B,QAAQ,CAAS;IAEzB,YAAY,QAAoC;QAC9C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,IAAI,MAAM;QACR,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1D,MAAM,MAAM,GAAG,OAAO,CACpB,SAAS,EACT,wBAAwB,IAAI,CAAC,QAAQ,OAAO,CAC7C,CAAC;YACF,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;YACtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maxminddatabase/geolite2",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MaxMind Database GeoLite2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"./types": {
|
|
11
|
+
"import": "./dist/types.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"dev": "tsc --watch",
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"clean": "npx rimraf ./dist",
|
|
18
|
+
"npm:publish": "npm run clean && npm run build && npm publish",
|
|
19
|
+
"prettier": "prettier --write \"src/**/*.ts\"",
|
|
20
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+ssh://git@github.com/MaxMindDatabase/GeoLite2.git"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [],
|
|
27
|
+
"author": "",
|
|
28
|
+
"license": "ISC",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@maxmind/geoip2-node": "^6.2.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^24.7.2",
|
|
34
|
+
"prettier": "^3.6.2"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"database",
|
|
38
|
+
"dist"
|
|
39
|
+
],
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
}
|
|
43
|
+
}
|