Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: runk/node-maxmind
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.3.19
Choose a base ref
...
head repository: runk/node-maxmind
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.3.20
Choose a head ref
  • 4 commits
  • 5 files changed
  • 3 contributors

Commits on May 2, 2024

  1. chore(deps): update dependency @types/node to v20.12.8

    renovate[bot] committed May 2, 2024
    Copy the full SHA
    41c1751 View commit details

Commits on May 9, 2024

  1. minor: Reduce default cache size to 10_000 items (#836)

    - Currently it's set to 60k items which is a bit too aggressive for most users, which results in extra memory consumption.
    - Align default size setting with README
    
    Co-authored-by: Dmitry Shirokov <dshirokov@atlassian.com>
    runk and Dmitry Shirokov authored May 9, 2024
    Copy the full SHA
    1913338 View commit details

Commits on Jun 1, 2024

  1. chore(deps): update dependency ts-jest to v29.1.4

    renovate[bot] committed Jun 1, 2024
    Copy the full SHA
    5dc848c View commit details
  2. fix(deps): update dependency mmdb-lib to v2.1.1

    renovate[bot] committed Jun 1, 2024
    Copy the full SHA
    2307136 View commit details
Showing with 8 additions and 7 deletions.
  1. +1 −0 .gitignore
  2. +1 −1 LICENSE
  3. +2 −2 README.md
  4. +3 −3 package.json
  5. +1 −1 src/index.ts
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -6,3 +6,4 @@ coverage
npm-debug.log
.nyc_output
lib
.vscode
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2023 Dmitry Shirokov
Copyright (c) 2024 Dmitry Shirokov

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -65,9 +65,9 @@ _maxmind.open(filepath, [options])_
- `filepath`: `<string>` Path to the binary mmdb database file.
- `options`: `<Object>`
- `cache`: `<Object>` Cache options. Under the bonnet module uses [tiny-lru](https://github.com/avoidwork/tiny-lru) cache.
- `max`: `<number>` Max cache items to keep in memory. _Default_: `6000`.
- `max`: `<number>` Max cache items to keep in memory. _Default_: `10_000`.
- `watchForUpdates`: `<boolean>` Supports reloading the reader when changes occur to the database that is loaded. _Default_: `false`.
- `watchForUpdatesNonPersistent`: `<boolean>` Controlls wether the watcher should be persistent or not. If it is persistent, a node process will be blocked in watching state if the watcher is the only thing still running in the program. _Default_: `false`.
- `watchForUpdatesNonPersistent`: `<boolean>` Controls whether the watcher should be persistent or not. If it is persistent, a node process will be blocked in watching state if the watcher is the only thing still running in the program. _Default_: `false`.
- `watchForUpdatesHook`: `<Function>` Hook function that is fired on database update. _Default_: `null`.

## Does it work in browser?
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -26,22 +26,22 @@
"Gregory Oschwald @oschwald"
],
"dependencies": {
"mmdb-lib": "2.1.0",
"mmdb-lib": "2.1.1",
"tiny-lru": "11.2.6"
},
"devDependencies": {
"@types/ip6addr": "0.2.6",
"@types/jest": "29.5.12",
"@types/netmask": "2.0.5",
"@types/node": "20.12.7",
"@types/node": "20.12.8",
"@types/sinon": "17.0.3",
"ip-address": "9.0.5",
"ip6addr": "0.2.5",
"jest": "29.7.0",
"prettier": "3.2.5",
"semantic-release": "23.0.8",
"sinon": "17.0.1",
"ts-jest": "29.1.2",
"ts-jest": "29.1.4",
"typescript": "5.4.5"
},
"repository": {
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ export const open = async <T extends Response>(
);
}

const cache = lru(opts?.cache?.max || 60000);
const cache = lru(opts?.cache?.max || 10_000);
const reader = new Reader<T>(database, { cache });

if (opts && !!opts.watchForUpdates) {