Skip to content

Commit d6507d1

Browse files
committed
Update
1 parent 8988db3 commit d6507d1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,25 @@ GEOIP_DATA_DIR=/some/path
175175
GEOIP_TMP_DIR=/some/path
176176
```
177177

178+
Alternatively, you can set the data directory programmatically before requiring the module:
179+
180+
```js
181+
globalThis['geoDataDir'] = '/some/path';
182+
const geoIp = require('geoip-lite2');
183+
```
184+
185+
### Clearing in-memory data
186+
187+
`clear()` releases all in-memory GeoIP buffers. Subsequent lookups return `null` until data is reloaded.
188+
189+
```js
190+
geoIp.clear();
191+
// all lookups return null now
192+
193+
geoIp.reloadDataSync();
194+
// data restored
195+
```
196+
178197

179198
## ⚠️ Caveats
180199
This package includes the GeoLite database from MaxMind. It is not the most accurate database available,

0 commit comments

Comments
 (0)