@zwa73/utils 1.0.230 → 1.0.231
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/dist/UtilFileTools.d.ts +3 -5
- package/dist/UtilFileTools.js +4 -4
- package/dist/UtilHttp.js +9 -9
- package/package.json +1 -3
package/dist/UtilFileTools.d.ts
CHANGED
|
@@ -27,8 +27,6 @@ type FileSearchGlobOpt = Partial<{
|
|
|
27
27
|
type FileSearchRegexOpt = Partial<{
|
|
28
28
|
/**搜索子目录 默认 true */
|
|
29
29
|
recursive: boolean;
|
|
30
|
-
/**无效项 */
|
|
31
|
-
relative: never;
|
|
32
30
|
/**忽略目录 默认 true */
|
|
33
31
|
nodir: boolean;
|
|
34
32
|
}>;
|
|
@@ -172,7 +170,7 @@ export declare namespace UtilFT {
|
|
|
172
170
|
* @param dir - 起始目录
|
|
173
171
|
* @param traitRegex - 正则表达式
|
|
174
172
|
* @param opt - 可选参数
|
|
175
|
-
* @param opt.
|
|
173
|
+
* @param opt.recursive - 搜索子目录
|
|
176
174
|
* @returns 文件名路径数组
|
|
177
175
|
*/
|
|
178
176
|
function fileSearchRegexSync(dir: string, traitRegex: string | RegExp, opt?: FileSearchRegexOpt): string[];
|
|
@@ -181,7 +179,7 @@ export declare namespace UtilFT {
|
|
|
181
179
|
* @param globPattern - glob匹配
|
|
182
180
|
* @param opt - 可选参数
|
|
183
181
|
* @param opt.ignore - 忽略的文件
|
|
184
|
-
* @param opt.
|
|
182
|
+
* @param opt.recursive - 忽略目录 默认 true
|
|
185
183
|
* @param opt.nodir - 忽略大小写 默认 跟随系统 mac/win为true 其他false
|
|
186
184
|
* @returns 文件绝对路径数组
|
|
187
185
|
*/
|
|
@@ -191,7 +189,7 @@ export declare namespace UtilFT {
|
|
|
191
189
|
* @param globPattern - glob匹配
|
|
192
190
|
* @param opt - 可选参数
|
|
193
191
|
* @param opt.ignore - 忽略的文件
|
|
194
|
-
* @param opt.
|
|
192
|
+
* @param opt.recursive - 忽略目录 默认 true
|
|
195
193
|
* @param opt.nodir - 忽略大小写 默认 跟随系统 mac/win为true 其他false
|
|
196
194
|
* @returns 文件绝对路径数组
|
|
197
195
|
*/
|
package/dist/UtilFileTools.js
CHANGED
|
@@ -297,7 +297,7 @@ var UtilFT;
|
|
|
297
297
|
return recursive(nextPath);
|
|
298
298
|
return [nextPath, ...await recursive(nextPath)];
|
|
299
299
|
}
|
|
300
|
-
if (regex.test(nextPath))
|
|
300
|
+
if (subFile.isFile() && regex.test(nextPath))
|
|
301
301
|
return [subFilePath];
|
|
302
302
|
return [undefined];
|
|
303
303
|
}));
|
|
@@ -312,7 +312,7 @@ var UtilFT;
|
|
|
312
312
|
* @param dir - 起始目录
|
|
313
313
|
* @param traitRegex - 正则表达式
|
|
314
314
|
* @param opt - 可选参数
|
|
315
|
-
* @param opt.
|
|
315
|
+
* @param opt.recursive - 搜索子目录
|
|
316
316
|
* @returns 文件名路径数组
|
|
317
317
|
*/
|
|
318
318
|
function fileSearchRegexSync(dir, traitRegex, opt) {
|
|
@@ -347,7 +347,7 @@ var UtilFT;
|
|
|
347
347
|
* @param globPattern - glob匹配
|
|
348
348
|
* @param opt - 可选参数
|
|
349
349
|
* @param opt.ignore - 忽略的文件
|
|
350
|
-
* @param opt.
|
|
350
|
+
* @param opt.recursive - 忽略目录 默认 true
|
|
351
351
|
* @param opt.nodir - 忽略大小写 默认 跟随系统 mac/win为true 其他false
|
|
352
352
|
* @returns 文件绝对路径数组
|
|
353
353
|
*/
|
|
@@ -364,7 +364,7 @@ var UtilFT;
|
|
|
364
364
|
* @param globPattern - glob匹配
|
|
365
365
|
* @param opt - 可选参数
|
|
366
366
|
* @param opt.ignore - 忽略的文件
|
|
367
|
-
* @param opt.
|
|
367
|
+
* @param opt.recursive - 忽略目录 默认 true
|
|
368
368
|
* @param opt.nodir - 忽略大小写 默认 跟随系统 mac/win为true 其他false
|
|
369
369
|
* @returns 文件绝对路径数组
|
|
370
370
|
*/
|
package/dist/UtilHttp.js
CHANGED
|
@@ -381,13 +381,13 @@ class UtilHttp {
|
|
|
381
381
|
res.on('data', chunk => {
|
|
382
382
|
dataPromise = reduceQueue
|
|
383
383
|
.enqueue(async () => mergedata = await reduce(mergedata, chunk))
|
|
384
|
-
.catch(
|
|
385
|
-
UtilLogger_1.SLogger.error(`${flagName} reduce
|
|
384
|
+
.catch(err => {
|
|
385
|
+
UtilLogger_1.SLogger.error(`${flagName} reduce函数错误:`, err, `chunk:${chunk}\nmergedata:`, mergedata);
|
|
386
386
|
resolve(undefined);
|
|
387
387
|
});
|
|
388
388
|
});
|
|
389
|
-
res.on('error',
|
|
390
|
-
UtilLogger_1.SLogger.warn(`${flagName}
|
|
389
|
+
res.on('error', err => {
|
|
390
|
+
UtilLogger_1.SLogger.warn(`${flagName} 接收反馈错误:`, err);
|
|
391
391
|
resolve(undefined);
|
|
392
392
|
});
|
|
393
393
|
res.on('end', async () => {
|
|
@@ -400,7 +400,7 @@ class UtilHttp {
|
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
402
|
catch (err) {
|
|
403
|
-
UtilLogger_1.SLogger.warn(`${flagName}
|
|
403
|
+
UtilLogger_1.SLogger.warn(`${flagName} 未知错误:`, err);
|
|
404
404
|
resolve(undefined);
|
|
405
405
|
return;
|
|
406
406
|
}
|
|
@@ -416,15 +416,15 @@ class UtilHttp {
|
|
|
416
416
|
req.destroy();
|
|
417
417
|
});
|
|
418
418
|
}
|
|
419
|
-
req.on('error',
|
|
420
|
-
UtilLogger_1.SLogger.warn(`${flagName}
|
|
419
|
+
req.on('error', err => {
|
|
420
|
+
UtilLogger_1.SLogger.warn(`${flagName} 发送请求错误:`, err);
|
|
421
421
|
resolve(undefined);
|
|
422
422
|
});
|
|
423
423
|
try {
|
|
424
424
|
await proc(req);
|
|
425
425
|
}
|
|
426
|
-
catch (
|
|
427
|
-
UtilLogger_1.SLogger.error(`${flagName} proc
|
|
426
|
+
catch (err) {
|
|
427
|
+
UtilLogger_1.SLogger.error(`${flagName} proc函数错误:`, err);
|
|
428
428
|
resolve(undefined);
|
|
429
429
|
}
|
|
430
430
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zwa73/utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.231",
|
|
4
4
|
"description": "my utils",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -37,8 +37,6 @@
|
|
|
37
37
|
"@types/jest": "^29.5.12",
|
|
38
38
|
"@types/node": "^20.14.11",
|
|
39
39
|
"@zwa73/dev-utils": "*",
|
|
40
|
-
"jest": "^29.7.0",
|
|
41
|
-
"ts-jest": "^29.1.2",
|
|
42
40
|
"tsc-alias": "^1.8.8",
|
|
43
41
|
"typescript": "^5.3.3"
|
|
44
42
|
},
|