@k03mad/ip2geo 9.0.0 → 9.2.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/cli.js +1 -0
- package/app/helpers/cache.js +8 -0
- package/package.json +1 -1
package/app/cli.js
CHANGED
package/app/helpers/cache.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
|
+
import {log} from '@k03mad/simple-log';
|
|
5
|
+
import chalk from 'chalk';
|
|
4
6
|
import _debug from 'debug';
|
|
5
7
|
|
|
8
|
+
const {dim, bold} = chalk;
|
|
9
|
+
|
|
6
10
|
const debug = _debug('mad:geoip');
|
|
7
11
|
|
|
8
12
|
const outputKeys = [
|
|
@@ -170,6 +174,7 @@ export const pruneCache = async (cacheDir, cacheFileSeparator, cacheFileNewline)
|
|
|
170
174
|
|
|
171
175
|
let duplicates = 0;
|
|
172
176
|
let empty = 0;
|
|
177
|
+
let counter = 0;
|
|
173
178
|
const longLinesFiles = new Set();
|
|
174
179
|
|
|
175
180
|
await Promise.all(files.map(async file => {
|
|
@@ -196,6 +201,9 @@ export const pruneCache = async (cacheDir, cacheFileSeparator, cacheFileNewline)
|
|
|
196
201
|
|
|
197
202
|
empty += dataArr.length - dataArrRemoveEmpty.length;
|
|
198
203
|
duplicates += dataArrRemoveEmpty.length - uniq.length;
|
|
204
|
+
|
|
205
|
+
counter++;
|
|
206
|
+
log(`${bold(dim(`[${counter}/${files.length}]`))} ${dim(fullFilePath)}`);
|
|
199
207
|
}));
|
|
200
208
|
|
|
201
209
|
return {duplicates, empty, longLinesFiles};
|