We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d30a451 commit 259a6c9Copy full SHA for 259a6c9
README.md
@@ -83,6 +83,26 @@ dbWatcher.on('update', () => {
83
dbWatcher.close();
84
```
85
86
+### Usage with TypeScript
87
+
88
+This package includes its own types and you can pass the response type in `open`:
89
90
+```ts
91
+import geolite2 from 'geolite2-redist';
92
+import maxmind, { CityResponse } from 'maxmind';
93
94
+(async () => {
95
+ let lookup = await geolite2.open<CityResponse>('GeoLite2-City', path => {
96
+ return maxmind.open(path);
97
+ });
98
99
+ let city = lookup.get('66.6.44.4');
100
101
+ // Call this when done to empty node's event loop
102
+ lookup.close();
103
+})();
104
+```
105
106
## API
107
108
### Methods
0 commit comments