@k03mad/ip2geo 9.0.0 → 9.1.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/app/helpers/cache.js +8 -0
- package/package.json +3 -2
package/app/helpers/cache.js
CHANGED
|
@@ -2,6 +2,7 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
4
|
import _debug from 'debug';
|
|
5
|
+
import ora from 'ora';
|
|
5
6
|
|
|
6
7
|
const debug = _debug('mad:geoip');
|
|
7
8
|
|
|
@@ -170,8 +171,11 @@ export const pruneCache = async (cacheDir, cacheFileSeparator, cacheFileNewline)
|
|
|
170
171
|
|
|
171
172
|
let duplicates = 0;
|
|
172
173
|
let empty = 0;
|
|
174
|
+
let counter = 0;
|
|
173
175
|
const longLinesFiles = new Set();
|
|
174
176
|
|
|
177
|
+
const spinner = ora().start();
|
|
178
|
+
|
|
175
179
|
await Promise.all(files.map(async file => {
|
|
176
180
|
const fullFilePath = path.join(cacheDir, file);
|
|
177
181
|
|
|
@@ -196,7 +200,11 @@ export const pruneCache = async (cacheDir, cacheFileSeparator, cacheFileNewline)
|
|
|
196
200
|
|
|
197
201
|
empty += dataArr.length - dataArrRemoveEmpty.length;
|
|
198
202
|
duplicates += dataArrRemoveEmpty.length - uniq.length;
|
|
203
|
+
|
|
204
|
+
counter++;
|
|
205
|
+
spinner.text = `[${counter}/${files.length}]: ${fullFilePath}`;
|
|
199
206
|
}));
|
|
200
207
|
|
|
208
|
+
spinner.stop();
|
|
201
209
|
return {duplicates, empty, longLinesFiles};
|
|
202
210
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k03mad/ip2geo",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"description": "GeoIP library",
|
|
5
5
|
"maintainers": [
|
|
6
6
|
"Kirill Molchanov <k03.mad@gmail.com"
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"@k03mad/request": "6.1.0",
|
|
23
23
|
"@k03mad/simple-log": "2.3.0",
|
|
24
24
|
"chalk": "5.3.0",
|
|
25
|
-
"debug": "4.3.6"
|
|
25
|
+
"debug": "4.3.6",
|
|
26
|
+
"ora": "8.0.1"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
29
|
"@k03mad/eslint-config": "23.0.0",
|