@zwa73/utils 1.0.57 → 1.0.61

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.
Files changed (42) hide show
  1. package/dist/UtilCodecs.d.ts +16 -16
  2. package/dist/UtilCodecs.js +16 -16
  3. package/dist/UtilCom.d.ts +22 -25
  4. package/dist/UtilCom.js +35 -38
  5. package/dist/UtilDecorators.d.ts +15 -8
  6. package/dist/UtilDecorators.js +79 -25
  7. package/dist/UtilFP.d.ts +46 -0
  8. package/dist/UtilFP.js +52 -0
  9. package/dist/UtilFfmpegTools.d.ts +30 -30
  10. package/dist/UtilFfmpegTools.js +32 -32
  11. package/dist/UtilFileTools.d.ts +30 -35
  12. package/dist/UtilFileTools.js +17 -18
  13. package/dist/UtilFunctions.d.ts +37 -78
  14. package/dist/UtilFunctions.js +27 -62
  15. package/dist/UtilInterfaces.d.ts +11 -11
  16. package/dist/UtilInterfaces.js +2 -2
  17. package/dist/UtilLogger.d.ts +55 -55
  18. package/dist/UtilLogger.js +55 -55
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.js +1 -0
  21. package/dist/test/composeTest.d.ts +21 -0
  22. package/dist/test/composeTest.js +33 -0
  23. package/dist/test/importtest.d.ts +1 -0
  24. package/dist/test/importtest.js +4 -0
  25. package/dist/test/test.js +5 -3
  26. package/package.json +2 -2
  27. package/src/UtilClass.ts +1051 -1051
  28. package/src/UtilCodecs.ts +117 -117
  29. package/src/UtilCom.ts +171 -174
  30. package/src/UtilDecorators.ts +174 -116
  31. package/src/UtilFP.ts +98 -0
  32. package/src/UtilFfmpegTools.ts +271 -271
  33. package/src/UtilFileTools.ts +231 -236
  34. package/src/UtilFunctions.ts +289 -364
  35. package/src/UtilInterfaces.ts +137 -137
  36. package/src/UtilLogger.ts +386 -386
  37. package/src/index.ts +10 -9
  38. package/src/test/composeTest.ts +37 -0
  39. package/src/test/importtest.ts +5 -0
  40. package/src/test/test.ts +8 -6
  41. package/src/test/test2.ts +2 -3
  42. package/tsconfig.json +2 -7
package/src/UtilCodecs.ts CHANGED
@@ -1,118 +1,118 @@
1
- import * as he from 'html-entities';
2
- import {get_encoding,Tiktoken} from 'tiktoken';
3
-
4
-
5
-
6
- /**编码/解码器 */
7
- export namespace UtilCodec{
8
-
9
-
10
- let encoderTurbo:Tiktoken|null = null;
11
- let encoderDavinci:Tiktoken|null = null;
12
- const textDecoder = new TextDecoder();
13
-
14
- // 定义一个对象,存储常见的HTML实体和对应的字符
15
- let htmlEntities:Record<string,string> = {
16
- "&lt;": "<",
17
- "&gt;": ">",
18
- "&amp;": "&",
19
- "&quot;": "\"",
20
- "&#39;": "'",
21
- "&#91;": "[",
22
- "&#93;": "]"
23
- };
24
-
25
- /**HTML实体解码 将一个字符串中的HTML实体转换为对应的字符
26
- * @param {string} str - 要转换的字符串
27
- * @returns {string} 转换后的字符串
28
- */
29
- export function decodeHtmlEntities(str:string) {
30
- //for(let code in htmlEntities){
31
- // let cha = htmlEntities[code]
32
- // str = str.replaceAll(code, cha);
33
- //}
34
- //return str
35
- return he.decode(str);
36
- }
37
-
38
- /**HTML实体编码 将一个字符串中的 需编码字符转换为 HTML实体
39
- * @param {string} str - 要转换的字符串
40
- * @returns {string} 转换后的字符串
41
- */
42
- export function encodeHtmlEntities(str:string) {
43
- //for(let code in htmlEntities){
44
- // let cha = htmlEntities[code]
45
- // str = str.replaceAll(cha, code);
46
- //}
47
- //return str
48
- return he.encode(str);
49
- }
50
-
51
-
52
- //token长度计算器
53
- //cl100k_base ChatGPT models, text-embedding-ada-002
54
- //p50k_base Code models, text-davinci-002, text-davinci-003
55
- //r50k_base (or gpt2) GPT-3 models like davinci
56
-
57
-
58
- //避免在nextjs调用时出错
59
- function initTikTokenEncoder (){
60
- if(encoderTurbo!=null && encoderDavinci!=null)
61
- return;
62
-
63
- encoderTurbo = get_encoding("cl100k_base");
64
- encoderDavinci = get_encoding("p50k_base");
65
- }
66
-
67
- /**token长度计算器 Turbo模型
68
- * @param {string} str = 所要计算的消息
69
- * @returns {number} 整数长度结果
70
- */
71
- export function tokenNumTurbo(str:string):number{
72
- initTikTokenEncoder();
73
- //return encoder.encode(str).length
74
- return encoderTurbo?.encode(str).length as any as number;
75
- }
76
- /**token长度计算器 Davinci模型
77
- * @param {string} str = 所要计算的消息
78
- * @returns {number} 整数长度结果
79
- */
80
- export function tokenNumDavinci(str:string):number{
81
- initTikTokenEncoder();
82
- return encoderDavinci?.encode(str).length as any as number;
83
- }
84
-
85
- /**token编码 Turbo模型
86
- * @param {string} str = 所要计算的消息
87
- * @returns {Array<number>} Token数组
88
- */
89
- export function encodeTokenTurbo(str:string):Uint32Array{
90
- initTikTokenEncoder();
91
- return encoderTurbo?.encode(str) as any as Uint32Array
92
- }
93
- /**token编码 Davinci模型
94
- * @param {string} str = 所要计算的消息
95
- * @returns {Array<number>} Token数组
96
- */
97
- export function encodeTokenDavinci(str:string):Uint32Array{
98
- initTikTokenEncoder();
99
- return encoderDavinci?.encode(str) as any as Uint32Array;
100
- }
101
- /**token解码 Turbo模型
102
- * @param {Array<number>} arr = Token数组
103
- * @returns {string} 消息字符串
104
- */
105
- export function decodeTokenTurbo(arr:Uint32Array):string{
106
- initTikTokenEncoder();
107
- return textDecoder.decode(encoderTurbo?.decode(arr));
108
- }
109
- /**token解码 Davinci模型
110
- * @param {Array<number>} arr = Token数组
111
- * @returns {string} 消息字符串
112
- */
113
- export function decodeTokenDavinci(arr:Uint32Array):string{
114
- initTikTokenEncoder();
115
- return textDecoder.decode(encoderDavinci?.decode(arr));
116
- }
117
-
1
+ import * as he from 'html-entities';
2
+ import {get_encoding,Tiktoken} from 'tiktoken';
3
+
4
+
5
+
6
+ /**编码/解码器 */
7
+ export namespace UtilCodec{
8
+
9
+
10
+ let encoderTurbo:Tiktoken|null = null;
11
+ let encoderDavinci:Tiktoken|null = null;
12
+ const textDecoder = new TextDecoder();
13
+
14
+ // 定义一个对象,存储常见的HTML实体和对应的字符
15
+ let htmlEntities:Record<string,string> = {
16
+ "&lt;": "<",
17
+ "&gt;": ">",
18
+ "&amp;": "&",
19
+ "&quot;": "\"",
20
+ "&#39;": "'",
21
+ "&#91;": "[",
22
+ "&#93;": "]"
23
+ };
24
+
25
+ /**HTML实体解码 将一个字符串中的HTML实体转换为对应的字符
26
+ * @param str - 要转换的字符串
27
+ * @returns 转换后的字符串
28
+ */
29
+ export function decodeHtmlEntities(str:string) {
30
+ //for(let code in htmlEntities){
31
+ // let cha = htmlEntities[code]
32
+ // str = str.replaceAll(code, cha);
33
+ //}
34
+ //return str
35
+ return he.decode(str);
36
+ }
37
+
38
+ /**HTML实体编码 将一个字符串中的 需编码字符转换为 HTML实体
39
+ * @param str - 要转换的字符串
40
+ * @returns 转换后的字符串
41
+ */
42
+ export function encodeHtmlEntities(str:string) {
43
+ //for(let code in htmlEntities){
44
+ // let cha = htmlEntities[code]
45
+ // str = str.replaceAll(cha, code);
46
+ //}
47
+ //return str
48
+ return he.encode(str);
49
+ }
50
+
51
+
52
+ //token长度计算器
53
+ //cl100k_base ChatGPT models, text-embedding-ada-002
54
+ //p50k_base Code models, text-davinci-002, text-davinci-003
55
+ //r50k_base (or gpt2) GPT-3 models like davinci
56
+
57
+
58
+ //避免在nextjs调用时出错
59
+ function initTikTokenEncoder (){
60
+ if(encoderTurbo!=null && encoderDavinci!=null)
61
+ return;
62
+
63
+ encoderTurbo = get_encoding("cl100k_base");
64
+ encoderDavinci = get_encoding("p50k_base");
65
+ }
66
+
67
+ /**token长度计算器 Turbo模型
68
+ * @param str = 所要计算的消息
69
+ * @returns 整数长度结果
70
+ */
71
+ export function tokenNumTurbo(str:string):number{
72
+ initTikTokenEncoder();
73
+ //return encoder.encode(str).length
74
+ return encoderTurbo?.encode(str).length as any as number;
75
+ }
76
+ /**token长度计算器 Davinci模型
77
+ * @param str = 所要计算的消息
78
+ * @returns 整数长度结果
79
+ */
80
+ export function tokenNumDavinci(str:string):number{
81
+ initTikTokenEncoder();
82
+ return encoderDavinci?.encode(str).length as any as number;
83
+ }
84
+
85
+ /**token编码 Turbo模型
86
+ * @param str = 所要计算的消息
87
+ * @returns Token数组
88
+ */
89
+ export function encodeTokenTurbo(str:string):Uint32Array{
90
+ initTikTokenEncoder();
91
+ return encoderTurbo?.encode(str) as any as Uint32Array
92
+ }
93
+ /**token编码 Davinci模型
94
+ * @param str = 所要计算的消息
95
+ * @returns Token数组
96
+ */
97
+ export function encodeTokenDavinci(str:string):Uint32Array{
98
+ initTikTokenEncoder();
99
+ return encoderDavinci?.encode(str) as any as Uint32Array;
100
+ }
101
+ /**token解码 Turbo模型
102
+ * @param arr = Token数组
103
+ * @returns 消息字符串
104
+ */
105
+ export function decodeTokenTurbo(arr:Uint32Array):string{
106
+ initTikTokenEncoder();
107
+ return textDecoder.decode(encoderTurbo?.decode(arr));
108
+ }
109
+ /**token解码 Davinci模型
110
+ * @param arr = Token数组
111
+ * @returns 消息字符串
112
+ */
113
+ export function decodeTokenDavinci(arr:Uint32Array):string{
114
+ initTikTokenEncoder();
115
+ return textDecoder.decode(encoderDavinci?.decode(arr));
116
+ }
117
+
118
118
  }
package/src/UtilCom.ts CHANGED
@@ -1,175 +1,172 @@
1
- import { JObject, PromiseVerifyFn, stringifyJToken } from "./UtilInterfaces";
2
- import * as https from 'https';
3
- import * as http from 'http';
4
- import { SLogger } from "./UtilLogger";
5
- import { UtilFunc } from "./UtilFunctions";
6
-
7
-
8
- /**网络工具 */
9
- export namespace UtilCom{
10
-
11
- /**通用post处理
12
- * @param {"http"|"https"} posttype - post类型
13
- * @param {JObject} json - 数据对象
14
- * @param {Object} options - 参数对象
15
- * @param {number} [timeLimit] - 超时时间/秒 最小为10秒
16
- * @returns {Promise<JObject|null>} 结果 null 为未能成功接收
17
- */
18
- function sPost(posttype:"http"|"https",json:JObject,options:Object,timeLimit:number=-1):Promise<JObject|null>{
19
- //转换为毫秒
20
- const hasTimeLimit = (timeLimit>=10);
21
- if(hasTimeLimit)
22
- timeLimit*=1000
23
-
24
- const jsonStr = stringifyJToken(json);
25
- const funcName = `s${posttype}Psot`;
26
-
27
- return new Promise((resolve, rejecte)=>{
28
- const resFunc = (res:http.IncomingMessage)=>{
29
- try{
30
- //请求超时
31
- if(hasTimeLimit){
32
- res.setTimeout(timeLimit, ()=>{
33
- //res.abort();
34
- SLogger.warn(`${funcName} 接收反馈超时: ${timeLimit} ms`);
35
- resolve(null);
36
- return;
37
- });
38
- }
39
-
40
- let resdata = "";
41
- res.setEncoding('utf8');
42
- res.on('data',(chunk)=>resdata+=chunk);
43
-
44
- res.on('error',(e)=>{
45
- SLogger.warn(`${funcName} 接收反馈错误:${e}`);
46
- resolve(null);
47
- return;
48
- });
49
-
50
- res.on('end',()=>{
51
- if(resdata==""){
52
- SLogger.warn(funcName+" 接收反馈错误: resdata 为空");
53
- resolve(null);
54
- return;
55
- }
56
- try{
57
- let obj = JSON.parse(resdata);
58
- SLogger.http(funcName+" 接受信息:",stringifyJToken(obj));
59
- resolve(obj);
60
- return;
61
- }
62
- catch(e){
63
- SLogger.warn(`${funcName} 接收反馈错误:${e}\n原始字符串:${resdata}`);
64
- resolve(null);
65
- return;
66
- }
67
- });
68
- }catch(err){
69
- SLogger.warn(funcName+" 未知错误:"+err);
70
- resolve(null);
71
- return;
72
- }
73
- };
74
- //路由 http/https
75
- let req:http.ClientRequest=null as any as http.ClientRequest;
76
- if(posttype === "https")
77
- req = https.request(options, resFunc);
78
- else if(posttype === "http")
79
- req = http.request(options, resFunc);
80
-
81
- //请求超时
82
- if(hasTimeLimit){
83
- req.setTimeout(timeLimit, ()=>{
84
- SLogger.warn(`${funcName} 发送请求超时: ${timeLimit} ms`);
85
- req.destroy();
86
- });
87
- }
88
-
89
- req.on('error', (e)=>{
90
- SLogger.warn(`${funcName} 发送请求错误:${e}`);
91
- resolve(null);
92
- });
93
-
94
- req.write(jsonStr);
95
- req.end();
96
- });
97
- }
98
-
99
- /**发送一个 https POST请求并接受数据
100
- * Object ()
101
- * @async
102
- * @param {JObject} json - 数据对象
103
- * @param {Object} options - 参数对象
104
- * @param {number} [timeLimit] - 超时时间/秒 最小为10秒
105
- * @returns {Promise<JObject|null>} 结果 null 为未能成功接收
106
- */
107
- export function shttpsPost(json:JObject,options:Object,timeLimit:number=-1):Promise<JObject|null>{
108
- return sPost("https",json,options,timeLimit);
109
- }
110
-
111
- /**发送一个 http POST请求并接受数据
112
- * Object ()
113
- * @async
114
- * @param {JObject} json - 数据对象
115
- * @param {Object} options - 参数对象
116
- * @param {number} [timeLimit] - 超时时间/秒 最小为10秒
117
- * @returns {Promise<JObject|null>} 结果 null 为未能成功接收
118
- */
119
- export function shttpPost(json:JObject,options:Object,timeLimit:number=-1):Promise<JObject|null>{
120
- return sPost("http",json,options,timeLimit);
121
- }
122
-
123
-
124
-
125
- /**通用重复post处理
126
- * @async
127
- * @param {"http"|"https"} posttype - post类型
128
- * @param {JObject} json - 数据对象
129
- * @param {Object} options - 参数对象
130
- * @param {number} [timeLimit] - 超时时间/秒 最小为10秒
131
- * @param {number} [repeatCount] - 重试次数
132
- * @param {number} [repeatTime] - 超时时间/秒 最小为10秒
133
- * @param {PromiseVerifyFn<JObject|null>} [verifyFn] - 判断有效性函数
134
- * @returns {Promise<JObject|null>} - 结果 null 为未能成功接收
135
- */
136
- async function sRepeatPost(posttype:"http"|"https",json:JObject,options:Object,timeLimit:number=-1,
137
- repeatCount:number=3,repeatTime:number=180,verifyFn?:PromiseVerifyFn<JObject|null>):Promise<JObject|null>{
138
- const procFn = ()=>sPost(posttype,json,options,timeLimit);
139
- return UtilFunc.repeatPromise(procFn,verifyFn,repeatCount,repeatTime);
140
- }
141
-
142
-
143
- /**重复一个 https POST请求并接受数据
144
- * Object ()
145
- * @async
146
- * @param {JObject} json - 数据对象
147
- * @param {Object} options - 参数对象
148
- * @param {number} [timeLimit] - 超时时间/秒 最小为10秒
149
- * @param {number} [repeatCount] - 重试次数
150
- * @param {number} [repeatTime] - 超时时间/秒 最小为10秒
151
- * @param {PromiseVerifyFn<JObject|null>} [verifyFn] - 判断有效性函数
152
- * @returns {Promise<JObject|null>} - 结果 null 为未能成功接收
153
- */
154
- export function shttpsRepeatPost(json:JObject,options:Object,timeLimit:number=-1,
155
- repeatCount:number=3,repeatTime:number=180,verifyFn?:PromiseVerifyFn<JObject|null>):Promise<JObject|null>{
156
- return sRepeatPost("https",json,options,timeLimit,repeatCount,repeatTime,verifyFn);
157
- }
158
-
159
- /**重复一个 http POST请求并接受数据
160
- * Object ()
161
- * @async
162
- * @param {JObject} json - 数据对象
163
- * @param {Object} options - 参数对象
164
- * @param {number} [timeLimit] - 超时时间/秒 最小为10秒
165
- * @param {number} [repeatCount] - 重试次数
166
- * @param {number} [repeatTime] - 超时时间/秒 最小为10秒
167
- * @param {PromiseVerifyFn<JObject|null>} [verifyFn] - 判断有效性函数
168
- * @returns {Promise<JObject|null>} - 结果 null 为未能成功接收
169
- */
170
- export function shttpRepeatPost(json:JObject,options:Object,timeLimit:number=-1,
171
- repeatCount:number=3,repeatTime:number=180,verifyFn?:PromiseVerifyFn<JObject|null>):Promise<JObject|null>{
172
- return sRepeatPost("http",json,options,timeLimit,repeatCount,repeatTime,verifyFn);
173
- }
174
-
1
+ import { JObject, PromiseVerifyFn, stringifyJToken } from "@src/UtilInterfaces";
2
+ import * as https from 'https';
3
+ import * as http from 'http';
4
+ import { SLogger } from "@src/UtilLogger";
5
+ import { UtilFunc } from "@src/UtilFunctions";
6
+
7
+
8
+ /**网络工具 */
9
+ export namespace UtilCom{
10
+
11
+ /**通用post处理
12
+ * @param posttype - post类型
13
+ * @param json - 数据对象
14
+ * @param options - 参数对象
15
+ * @param timeLimit - 超时时间/秒 最小为10秒
16
+ * @returns 结果 null 为未能成功接收
17
+ */
18
+ function sPost(posttype:"http"|"https",json:JObject,options:Object,timeLimit:number=-1):Promise<JObject|null>{
19
+ //转换为毫秒
20
+ const hasTimeLimit = (timeLimit>=10);
21
+ if(hasTimeLimit)
22
+ timeLimit*=1000
23
+
24
+ const jsonStr = stringifyJToken(json);
25
+ const funcName = `s${posttype}Psot`;
26
+
27
+ return new Promise((resolve, rejecte)=>{
28
+ const resFunc = (res:http.IncomingMessage)=>{
29
+ try{
30
+ //请求超时
31
+ if(hasTimeLimit){
32
+ res.setTimeout(timeLimit, ()=>{
33
+ //res.abort();
34
+ SLogger.warn(`${funcName} 接收反馈超时: ${timeLimit} ms`);
35
+ resolve(null);
36
+ return;
37
+ });
38
+ }
39
+
40
+ let resdata = "";
41
+ res.setEncoding('utf8');
42
+ res.on('data',(chunk)=>resdata+=chunk);
43
+
44
+ res.on('error',(e)=>{
45
+ SLogger.warn(`${funcName} 接收反馈错误:${e}`);
46
+ resolve(null);
47
+ return;
48
+ });
49
+
50
+ res.on('end',()=>{
51
+ if(resdata==""){
52
+ SLogger.warn(funcName+" 接收反馈错误: resdata 为空");
53
+ resolve(null);
54
+ return;
55
+ }
56
+ try{
57
+ let obj = JSON.parse(resdata);
58
+ SLogger.http(funcName+" 接受信息:",stringifyJToken(obj));
59
+ resolve(obj);
60
+ return;
61
+ }
62
+ catch(e){
63
+ SLogger.warn(`${funcName} 接收反馈错误:${e}\n原始字符串:${resdata}`);
64
+ resolve(null);
65
+ return;
66
+ }
67
+ });
68
+ }catch(err){
69
+ SLogger.warn(funcName+" 未知错误:"+err);
70
+ resolve(null);
71
+ return;
72
+ }
73
+ };
74
+ //路由 http/https
75
+ let req:http.ClientRequest=null as any as http.ClientRequest;
76
+ if(posttype === "https")
77
+ req = https.request(options, resFunc);
78
+ else if(posttype === "http")
79
+ req = http.request(options, resFunc);
80
+
81
+ //请求超时
82
+ if(hasTimeLimit){
83
+ req.setTimeout(timeLimit, ()=>{
84
+ SLogger.warn(`${funcName} 发送请求超时: ${timeLimit} ms`);
85
+ req.destroy();
86
+ });
87
+ }
88
+
89
+ req.on('error', (e)=>{
90
+ SLogger.warn(`${funcName} 发送请求错误:${e}`);
91
+ resolve(null);
92
+ });
93
+
94
+ req.write(jsonStr);
95
+ req.end();
96
+ });
97
+ }
98
+
99
+ /**发送一个 https POST请求并接受数据
100
+ * @async
101
+ * @param json - 数据对象
102
+ * @param options - 参数对象
103
+ * @param timeLimit - 超时时间/秒 最小为10秒
104
+ * @returns 结果 null 为未能成功接收
105
+ */
106
+ export function shttpsPost(json:JObject,options:Object,timeLimit:number=-1):Promise<JObject|null>{
107
+ return sPost("https",json,options,timeLimit);
108
+ }
109
+
110
+ /**发送一个 http POST请求并接受数据
111
+ * @async
112
+ * @param json - 数据对象
113
+ * @param options - 参数对象
114
+ * @param timeLimit - 超时时间/秒 最小为10秒
115
+ * @returns 结果 null 为未能成功接收
116
+ */
117
+ export function shttpPost(json:JObject,options:Object,timeLimit:number=-1):Promise<JObject|null>{
118
+ return sPost("http",json,options,timeLimit);
119
+ }
120
+
121
+
122
+
123
+ /**通用重复post处理
124
+ * @async
125
+ * @param posttype - post类型
126
+ * @param json - 数据对象
127
+ * @param options - 参数对象
128
+ * @param timeLimit - 超时时间/秒 最小为10秒
129
+ * @param repeatCount - 重试次数
130
+ * @param repeatTime - 超时时间/秒 最小为10秒
131
+ * @param verifyFn - 判断有效性函数
132
+ * @returns 结果 null 为未能成功接收
133
+ */
134
+ async function sRepeatPost(posttype:"http"|"https",json:JObject,options:Object,timeLimit:number=-1,
135
+ repeatCount:number=3,repeatTime:number=180,verifyFn?:PromiseVerifyFn<JObject|null>):Promise<JObject|null>{
136
+ const procFn = ()=>sPost(posttype,json,options,timeLimit);
137
+ return UtilFunc.repeatPromise(procFn,verifyFn,repeatCount,repeatTime);
138
+ }
139
+
140
+
141
+ /**重复一个 https POST请求并接受数据
142
+ * @async
143
+ * @param json - 数据对象
144
+ * @param options - 参数对象
145
+ * @param timeLimit - 超时时间/秒 最小为10秒
146
+ * @param repeatCount - 重试次数
147
+ * @param repeatTime - 超时时间/秒 最小为10秒
148
+ * @param verifyFn - 判断有效性函数
149
+ * @returns 结果 null 为未能成功接收
150
+ */
151
+ export function shttpsRepeatPost(json:JObject,options:Object,timeLimit:number=-1,
152
+ repeatCount:number=3,repeatTime:number=180,verifyFn?:PromiseVerifyFn<JObject|null>):Promise<JObject|null>{
153
+ return sRepeatPost("https",json,options,timeLimit,repeatCount,repeatTime,verifyFn);
154
+ }
155
+
156
+ /**重复一个 http POST请求并接受数据
157
+ * Object ()
158
+ * @async
159
+ * @param json - 数据对象
160
+ * @param options - 参数对象
161
+ * @param timeLimit - 超时时间/秒 最小为10秒
162
+ * @param repeatCount - 重试次数
163
+ * @param repeatTime - 超时时间/秒 最小为10秒
164
+ * @param verifyFn - 判断有效性函数
165
+ * @returns 结果 null 为未能成功接收
166
+ */
167
+ export function shttpRepeatPost(json:JObject,options:Object,timeLimit:number=-1,
168
+ repeatCount:number=3,repeatTime:number=180,verifyFn?:PromiseVerifyFn<JObject|null>):Promise<JObject|null>{
169
+ return sRepeatPost("http",json,options,timeLimit,repeatCount,repeatTime,verifyFn);
170
+ }
171
+
175
172
  }