@zwa73/utils 1.0.179 → 1.0.181
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/UtilCom.d.ts +1 -1
- package/dist/UtilCom.js +7 -7
- package/package.json +1 -1
- package/src/UtilCom.ts +11 -11
- package/src/UtilFfmpegTools.ts +1 -1
- package/src/UtilFileTools.ts +2 -2
- package/src/UtilFunctions.ts +2 -2
package/dist/UtilCom.d.ts
CHANGED
package/dist/UtilCom.js
CHANGED
|
@@ -28,7 +28,7 @@ var UtilCom;
|
|
|
28
28
|
//请求超时
|
|
29
29
|
if (hasTimeLimit) {
|
|
30
30
|
res.setTimeout(timeLimit, () => {
|
|
31
|
-
UtilLogger_1.SLogger.warn(`${flagName}
|
|
31
|
+
UtilLogger_1.SLogger.warn(`${flagName} 接收反馈超时: ${timeLimit} ms`);
|
|
32
32
|
resolve(undefined);
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -60,13 +60,13 @@ var UtilCom;
|
|
|
60
60
|
//请求超时
|
|
61
61
|
if (hasTimeLimit) {
|
|
62
62
|
req.setTimeout(timeLimit, () => {
|
|
63
|
-
UtilLogger_1.SLogger.warn(`${flagName}
|
|
64
|
-
req.destroy();
|
|
65
|
-
});
|
|
66
|
-
req.on('timeout', () => {
|
|
67
|
-
UtilLogger_1.SLogger.warn(`${flagName} 发送请求超时(timeout): ${timeLimit} ms`);
|
|
63
|
+
UtilLogger_1.SLogger.warn(`${flagName} 发送请求超时: ${timeLimit} ms`);
|
|
68
64
|
req.destroy();
|
|
69
65
|
});
|
|
66
|
+
//req.on('timeout', ()=>{
|
|
67
|
+
// SLogger.warn(`${flagName} 发送请求超时(timeout): ${timeLimit} ms`);
|
|
68
|
+
// req.destroy();
|
|
69
|
+
//});
|
|
70
70
|
}
|
|
71
71
|
req.on('error', (e) => {
|
|
72
72
|
UtilLogger_1.SLogger.warn(`${flagName} 发送请求错误:${e}`);
|
|
@@ -88,7 +88,7 @@ var UtilCom;
|
|
|
88
88
|
const queryString = querystring_1.default.stringify(reqData);
|
|
89
89
|
if (queryString) {
|
|
90
90
|
// 检查当前路径是否已经包含问号
|
|
91
|
-
const separator = comReqOpt
|
|
91
|
+
const separator = comReqOpt?.path?.includes('?') ? '&' : '?';
|
|
92
92
|
comReqOpt.path += separator + queryString;
|
|
93
93
|
}
|
|
94
94
|
}
|
package/package.json
CHANGED
package/src/UtilCom.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AnyString, JObject, PRecord, ReqVerifyFn } from "
|
|
1
|
+
import { AnyString, JObject, PRecord, ReqVerifyFn } from "@/src/UtilInterfaces";
|
|
2
2
|
import https from 'https';
|
|
3
3
|
import http from 'http';
|
|
4
|
-
import { SLogger } from "
|
|
5
|
-
import { RepeatPromiseOpt, RepeatPromiseResult, UtilFunc } from "
|
|
4
|
+
import { SLogger } from "@/src/UtilLogger";
|
|
5
|
+
import { RepeatPromiseOpt, RepeatPromiseResult, UtilFunc } from "@/src/UtilFunctions";
|
|
6
6
|
import qs from "querystring";
|
|
7
7
|
|
|
8
8
|
/**网络请求返回值 */
|
|
@@ -25,7 +25,7 @@ export type ComReqOpt = {
|
|
|
25
25
|
/**请求域名 */
|
|
26
26
|
hostname: string;
|
|
27
27
|
/**请求路径 */
|
|
28
|
-
path
|
|
28
|
+
path?: string;
|
|
29
29
|
/**请求方式 post 为 */
|
|
30
30
|
method: 'POST'|'GET';
|
|
31
31
|
/**端口 */
|
|
@@ -78,7 +78,7 @@ export async function comReq<T>(
|
|
|
78
78
|
//请求超时
|
|
79
79
|
if(hasTimeLimit){
|
|
80
80
|
res.setTimeout(timeLimit!, ()=>{
|
|
81
|
-
SLogger.warn(`${flagName}
|
|
81
|
+
SLogger.warn(`${flagName} 接收反馈超时: ${timeLimit} ms`);
|
|
82
82
|
resolve(undefined);
|
|
83
83
|
});
|
|
84
84
|
}
|
|
@@ -113,13 +113,13 @@ export async function comReq<T>(
|
|
|
113
113
|
//请求超时
|
|
114
114
|
if(hasTimeLimit){
|
|
115
115
|
req.setTimeout(timeLimit!, ()=>{
|
|
116
|
-
SLogger.warn(`${flagName}
|
|
117
|
-
req.destroy();
|
|
118
|
-
});
|
|
119
|
-
req.on('timeout', ()=>{
|
|
120
|
-
SLogger.warn(`${flagName} 发送请求超时(timeout): ${timeLimit} ms`);
|
|
116
|
+
SLogger.warn(`${flagName} 发送请求超时: ${timeLimit} ms`);
|
|
121
117
|
req.destroy();
|
|
122
118
|
});
|
|
119
|
+
//req.on('timeout', ()=>{
|
|
120
|
+
// SLogger.warn(`${flagName} 发送请求超时(timeout): ${timeLimit} ms`);
|
|
121
|
+
// req.destroy();
|
|
122
|
+
//});
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
req.on('error', (e)=>{
|
|
@@ -147,7 +147,7 @@ async function jsonReq<T extends ComReqOpt>(
|
|
|
147
147
|
const queryString = qs.stringify(reqData as GetReqData);
|
|
148
148
|
if (queryString) {
|
|
149
149
|
// 检查当前路径是否已经包含问号
|
|
150
|
-
const separator = comReqOpt
|
|
150
|
+
const separator = comReqOpt?.path?.includes('?') ? '&' : '?';
|
|
151
151
|
comReqOpt.path += separator + queryString;
|
|
152
152
|
}
|
|
153
153
|
}
|
package/src/UtilFfmpegTools.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { FfprobeData } from "fluent-ffmpeg";
|
|
|
2
2
|
import fluentFfmpeg from "fluent-ffmpeg";
|
|
3
3
|
import path from "pathe";
|
|
4
4
|
import * as fs from "fs";
|
|
5
|
-
import { SLogger } from "
|
|
5
|
+
import { SLogger } from "@/src/UtilLogger";
|
|
6
6
|
import { Stream } from "./UtilClass";
|
|
7
7
|
|
|
8
8
|
/**输入输出路径映射
|
package/src/UtilFileTools.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import path from 'pathe';
|
|
3
3
|
import * as os from "os";
|
|
4
|
-
import { JObject, JToken } from "
|
|
5
|
-
import { SLogger } from "
|
|
4
|
+
import { JObject, JToken } from "@/src/UtilInterfaces";
|
|
5
|
+
import { SLogger } from "@/src/UtilLogger";
|
|
6
6
|
import * as JSON5 from 'json5';
|
|
7
7
|
import { globSync, glob } from "glob";
|
|
8
8
|
import { UtilFunc } from "./UtilFunctions";
|
package/src/UtilFunctions.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as crypto from "crypto";
|
|
2
|
-
import { PRecord, AnyFunc, ExtractOutcome, IJData, JObject, JToken, Keyable, Literal, Matchable, MatchableFlag, Outcome, ReqStat, ReqVerifyFn, ProperSubsetCheck, UnionToIntersection, AnyRecord, AllExtends } from "
|
|
2
|
+
import { PRecord, AnyFunc, ExtractOutcome, IJData, JObject, JToken, Keyable, Literal, Matchable, MatchableFlag, Outcome, ReqStat, ReqVerifyFn, ProperSubsetCheck, UnionToIntersection, AnyRecord, AllExtends } from "@/src/UtilInterfaces";
|
|
3
3
|
import * as cp from "child_process";
|
|
4
|
-
import { LogLevel, SLogger } from "
|
|
4
|
+
import { LogLevel, SLogger } from "@/src/UtilLogger";
|
|
5
5
|
import { Completed, Failed, FailedLike, None, StatusSymbol, Success, SuccessLike, Terminated, Timeout } from "./UtilSymbol";
|
|
6
6
|
import { LogTimeAsync } from "./UtilDecorators";
|
|
7
7
|
import opath from 'path';
|