@maiyunnet/kebab 9.22.3 → 9.22.5
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/abox/master-log.d.ts +1 -0
- package/abox/master-log.js +26 -0
- package/abox/text.d.ts +2 -0
- package/abox/text.js +21 -0
- package/doc/kebab-rag.md +179 -155
- package/index.d.ts +7 -2
- package/index.js +1 -1
- package/lib/core.js +69 -139
- package/lib/text.d.ts +6 -4
- package/lib/text.js +11 -34
- package/package.json +4 -2
- package/sys/master.js +193 -283
- package/sys/route.d.ts +5 -5
- package/sys/route.js +33 -20
package/doc/kebab-rag.md
CHANGED
|
@@ -33,6 +33,10 @@ quick-start.md
|
|
|
33
33
|
- `view/`: 视图目录,存放 ejs 文件
|
|
34
34
|
- `ws/`: WebSocket 目录
|
|
35
35
|
|
|
36
|
+
## 请求主机与完整 URL
|
|
37
|
+
|
|
38
|
+
控制器通过 `this._config.const.hostCanonical` 获取用于 URL 的主机地址:HTTPS 的 443 和 HTTP 的 80 端口会省略,其余端口及 IPv6 方括号保留。`host`、`hostname` 和 `hostport` 保留原有含义。`urlOrigin`、`urlFull` 和 `urlStcFull` 使用 `hostCanonical` 生成,SSR 注入的 `_urlFull`、默认 `_staticPathFull` 同步省略默认端口。
|
|
39
|
+
|
|
36
40
|
## 集成 JSON Schema
|
|
37
41
|
|
|
38
42
|
控制器的 `_checkInput` 方法已集成 JSON Schema(ajv、ajv-formats),可通过 `schema` 参数使用,例如:
|
|
@@ -504,7 +508,7 @@ Defined in: [index.ts:183](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
504
508
|
|
|
505
509
|
> **ctrPath**: `string`
|
|
506
510
|
|
|
507
|
-
Defined in: [index.ts:
|
|
511
|
+
Defined in: [index.ts:215](https://github.com/maiyunnet/kebab/blob/master/index.ts#L215)
|
|
508
512
|
|
|
509
513
|
***
|
|
510
514
|
|
|
@@ -512,7 +516,7 @@ Defined in: [index.ts:210](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
512
516
|
|
|
513
517
|
> **dataPath**: `string`
|
|
514
518
|
|
|
515
|
-
Defined in: [index.ts:
|
|
519
|
+
Defined in: [index.ts:217](https://github.com/maiyunnet/kebab/blob/master/index.ts#L217)
|
|
516
520
|
|
|
517
521
|
***
|
|
518
522
|
|
|
@@ -520,7 +524,19 @@ Defined in: [index.ts:212](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
520
524
|
|
|
521
525
|
> **host**: `string`
|
|
522
526
|
|
|
523
|
-
Defined in: [index.ts:
|
|
527
|
+
Defined in: [index.ts:200](https://github.com/maiyunnet/kebab/blob/master/index.ts#L200)
|
|
528
|
+
|
|
529
|
+
原始主机地址,保留端口
|
|
530
|
+
|
|
531
|
+
***
|
|
532
|
+
|
|
533
|
+
### hostCanonical
|
|
534
|
+
|
|
535
|
+
> **hostCanonical**: `string`
|
|
536
|
+
|
|
537
|
+
Defined in: [index.ts:206](https://github.com/maiyunnet/kebab/blob/master/index.ts#L206)
|
|
538
|
+
|
|
539
|
+
用于 URL 的主机地址,仅省略 HTTPS 的 443 和 HTTP 的 80 端口,保留 IPv6 方括号
|
|
524
540
|
|
|
525
541
|
***
|
|
526
542
|
|
|
@@ -528,7 +544,9 @@ Defined in: [index.ts:199](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
528
544
|
|
|
529
545
|
> **hostname**: `string`
|
|
530
546
|
|
|
531
|
-
Defined in: [index.ts:
|
|
547
|
+
Defined in: [index.ts:202](https://github.com/maiyunnet/kebab/blob/master/index.ts#L202)
|
|
548
|
+
|
|
549
|
+
主机名,不含端口或 IPv6 方括号
|
|
532
550
|
|
|
533
551
|
***
|
|
534
552
|
|
|
@@ -536,7 +554,9 @@ Defined in: [index.ts:200](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
536
554
|
|
|
537
555
|
> **hostport**: `number`
|
|
538
556
|
|
|
539
|
-
Defined in: [index.ts:
|
|
557
|
+
Defined in: [index.ts:204](https://github.com/maiyunnet/kebab/blob/master/index.ts#L204)
|
|
558
|
+
|
|
559
|
+
请求端口
|
|
540
560
|
|
|
541
561
|
***
|
|
542
562
|
|
|
@@ -568,7 +588,7 @@ Defined in: [index.ts:195](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
568
588
|
|
|
569
589
|
> **modPath**: `string`
|
|
570
590
|
|
|
571
|
-
Defined in: [index.ts:
|
|
591
|
+
Defined in: [index.ts:214](https://github.com/maiyunnet/kebab/blob/master/index.ts#L214)
|
|
572
592
|
|
|
573
593
|
***
|
|
574
594
|
|
|
@@ -606,7 +626,7 @@ Defined in: [index.ts:189](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
606
626
|
|
|
607
627
|
> **rootPath**: `string`
|
|
608
628
|
|
|
609
|
-
Defined in: [index.ts:
|
|
629
|
+
Defined in: [index.ts:213](https://github.com/maiyunnet/kebab/blob/master/index.ts#L213)
|
|
610
630
|
|
|
611
631
|
***
|
|
612
632
|
|
|
@@ -630,7 +650,7 @@ Defined in: [index.ts:190](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
630
650
|
|
|
631
651
|
> **uri**: [`IUrlParse`](IUrlParse.md)
|
|
632
652
|
|
|
633
|
-
Defined in: [index.ts:
|
|
653
|
+
Defined in: [index.ts:209](https://github.com/maiyunnet/kebab/blob/master/index.ts#L209)
|
|
634
654
|
|
|
635
655
|
***
|
|
636
656
|
|
|
@@ -638,7 +658,7 @@ Defined in: [index.ts:204](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
638
658
|
|
|
639
659
|
> **urlBase**: `string`
|
|
640
660
|
|
|
641
|
-
Defined in: [index.ts:
|
|
661
|
+
Defined in: [index.ts:222](https://github.com/maiyunnet/kebab/blob/master/index.ts#L222)
|
|
642
662
|
|
|
643
663
|
***
|
|
644
664
|
|
|
@@ -646,7 +666,7 @@ Defined in: [index.ts:217](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
646
666
|
|
|
647
667
|
> **urlFull**: `string`
|
|
648
668
|
|
|
649
|
-
Defined in: [index.ts:
|
|
669
|
+
Defined in: [index.ts:224](https://github.com/maiyunnet/kebab/blob/master/index.ts#L224)
|
|
650
670
|
|
|
651
671
|
***
|
|
652
672
|
|
|
@@ -654,9 +674,9 @@ Defined in: [index.ts:219](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
654
674
|
|
|
655
675
|
> **urlOrigin**: `string`
|
|
656
676
|
|
|
657
|
-
Defined in: [index.ts:
|
|
677
|
+
Defined in: [index.ts:208](https://github.com/maiyunnet/kebab/blob/master/index.ts#L208)
|
|
658
678
|
|
|
659
|
-
协议与
|
|
679
|
+
协议与 hostCanonical,如 https://example.com:8443
|
|
660
680
|
|
|
661
681
|
***
|
|
662
682
|
|
|
@@ -664,7 +684,7 @@ Defined in: [index.ts:203](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
664
684
|
|
|
665
685
|
> **urlStc**: `string`
|
|
666
686
|
|
|
667
|
-
Defined in: [index.ts:
|
|
687
|
+
Defined in: [index.ts:223](https://github.com/maiyunnet/kebab/blob/master/index.ts#L223)
|
|
668
688
|
|
|
669
689
|
***
|
|
670
690
|
|
|
@@ -672,7 +692,7 @@ Defined in: [index.ts:218](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
672
692
|
|
|
673
693
|
> **urlStcFull**: `string`
|
|
674
694
|
|
|
675
|
-
Defined in: [index.ts:
|
|
695
|
+
Defined in: [index.ts:225](https://github.com/maiyunnet/kebab/blob/master/index.ts#L225)
|
|
676
696
|
|
|
677
697
|
***
|
|
678
698
|
|
|
@@ -680,7 +700,7 @@ Defined in: [index.ts:220](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
680
700
|
|
|
681
701
|
> **viewPath**: `string`
|
|
682
702
|
|
|
683
|
-
Defined in: [index.ts:
|
|
703
|
+
Defined in: [index.ts:216](https://github.com/maiyunnet/kebab/blob/master/index.ts#L216)
|
|
684
704
|
|
|
685
705
|
***
|
|
686
706
|
|
|
@@ -696,7 +716,7 @@ Defined in: [index.ts:196](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
696
716
|
|
|
697
717
|
> **wsPath**: `string`
|
|
698
718
|
|
|
699
|
-
Defined in: [index.ts:
|
|
719
|
+
Defined in: [index.ts:218](https://github.com/maiyunnet/kebab/blob/master/index.ts#L218)
|
|
700
720
|
|
|
701
721
|
index/interfaces/IConfigDb.md
|
|
702
722
|
---
|
|
@@ -1256,7 +1276,7 @@ index/interfaces/IPostFile.md
|
|
|
1256
1276
|
|
|
1257
1277
|
# Interface: IPostFile
|
|
1258
1278
|
|
|
1259
|
-
Defined in: [index.ts:
|
|
1279
|
+
Defined in: [index.ts:237](https://github.com/maiyunnet/kebab/blob/master/index.ts#L237)
|
|
1260
1280
|
|
|
1261
1281
|
上传的文件信息对象
|
|
1262
1282
|
|
|
@@ -1266,7 +1286,7 @@ Defined in: [index.ts:232](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1266
1286
|
|
|
1267
1287
|
> `readonly` **name**: `string`
|
|
1268
1288
|
|
|
1269
|
-
Defined in: [index.ts:
|
|
1289
|
+
Defined in: [index.ts:238](https://github.com/maiyunnet/kebab/blob/master/index.ts#L238)
|
|
1270
1290
|
|
|
1271
1291
|
***
|
|
1272
1292
|
|
|
@@ -1274,7 +1294,7 @@ Defined in: [index.ts:233](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1274
1294
|
|
|
1275
1295
|
> `readonly` **origin**: `string`
|
|
1276
1296
|
|
|
1277
|
-
Defined in: [index.ts:
|
|
1297
|
+
Defined in: [index.ts:239](https://github.com/maiyunnet/kebab/blob/master/index.ts#L239)
|
|
1278
1298
|
|
|
1279
1299
|
***
|
|
1280
1300
|
|
|
@@ -1282,7 +1302,7 @@ Defined in: [index.ts:234](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1282
1302
|
|
|
1283
1303
|
> `readonly` **path**: `string`
|
|
1284
1304
|
|
|
1285
|
-
Defined in: [index.ts:
|
|
1305
|
+
Defined in: [index.ts:241](https://github.com/maiyunnet/kebab/blob/master/index.ts#L241)
|
|
1286
1306
|
|
|
1287
1307
|
***
|
|
1288
1308
|
|
|
@@ -1290,7 +1310,7 @@ Defined in: [index.ts:236](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1290
1310
|
|
|
1291
1311
|
> `readonly` **size**: `number`
|
|
1292
1312
|
|
|
1293
|
-
Defined in: [index.ts:
|
|
1313
|
+
Defined in: [index.ts:240](https://github.com/maiyunnet/kebab/blob/master/index.ts#L240)
|
|
1294
1314
|
|
|
1295
1315
|
index/interfaces/IUrlParse.md
|
|
1296
1316
|
---
|
|
@@ -1404,7 +1424,7 @@ index/interfaces/IVhost.md
|
|
|
1404
1424
|
|
|
1405
1425
|
# Interface: IVhost
|
|
1406
1426
|
|
|
1407
|
-
Defined in: [index.ts:
|
|
1427
|
+
Defined in: [index.ts:229](https://github.com/maiyunnet/kebab/blob/master/index.ts#L229)
|
|
1408
1428
|
|
|
1409
1429
|
虚拟机配置对象
|
|
1410
1430
|
|
|
@@ -1414,7 +1434,7 @@ Defined in: [index.ts:224](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1414
1434
|
|
|
1415
1435
|
> `readonly` **domains**: `string`[]
|
|
1416
1436
|
|
|
1417
|
-
Defined in: [index.ts:
|
|
1437
|
+
Defined in: [index.ts:231](https://github.com/maiyunnet/kebab/blob/master/index.ts#L231)
|
|
1418
1438
|
|
|
1419
1439
|
***
|
|
1420
1440
|
|
|
@@ -1422,7 +1442,7 @@ Defined in: [index.ts:226](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1422
1442
|
|
|
1423
1443
|
> `readonly` `optional` **name?**: `string`
|
|
1424
1444
|
|
|
1425
|
-
Defined in: [index.ts:
|
|
1445
|
+
Defined in: [index.ts:230](https://github.com/maiyunnet/kebab/blob/master/index.ts#L230)
|
|
1426
1446
|
|
|
1427
1447
|
***
|
|
1428
1448
|
|
|
@@ -1430,7 +1450,7 @@ Defined in: [index.ts:225](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1430
1450
|
|
|
1431
1451
|
> `readonly` `optional` **remark?**: `string`
|
|
1432
1452
|
|
|
1433
|
-
Defined in: [index.ts:
|
|
1453
|
+
Defined in: [index.ts:233](https://github.com/maiyunnet/kebab/blob/master/index.ts#L233)
|
|
1434
1454
|
|
|
1435
1455
|
***
|
|
1436
1456
|
|
|
@@ -1438,7 +1458,7 @@ Defined in: [index.ts:228](https://github.com/maiyunnet/kebab/blob/master/index.
|
|
|
1438
1458
|
|
|
1439
1459
|
> `readonly` **root**: `string`
|
|
1440
1460
|
|
|
1441
|
-
Defined in: [index.ts:
|
|
1461
|
+
Defined in: [index.ts:232](https://github.com/maiyunnet/kebab/blob/master/index.ts#L232)
|
|
1442
1462
|
|
|
1443
1463
|
index.md
|
|
1444
1464
|
---
|
|
@@ -1717,7 +1737,7 @@ index/variables/VER.md
|
|
|
1717
1737
|
|
|
1718
1738
|
# Variable: VER
|
|
1719
1739
|
|
|
1720
|
-
> `const` **VER**: `"9.22.
|
|
1740
|
+
> `const` **VER**: `"9.22.5"` = `'9.22.5'`
|
|
1721
1741
|
|
|
1722
1742
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1723
1743
|
|
|
@@ -3707,7 +3727,7 @@ lib/core/functions/clone.md
|
|
|
3707
3727
|
|
|
3708
3728
|
> **clone**\<`T`\>(`obj`): `T`
|
|
3709
3729
|
|
|
3710
|
-
Defined in: [lib/core.ts:
|
|
3730
|
+
Defined in: [lib/core.ts:1468](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1468)
|
|
3711
3731
|
|
|
3712
3732
|
完整的克隆一份数组/对象
|
|
3713
3733
|
|
|
@@ -3771,7 +3791,7 @@ lib/core/functions/debug.md
|
|
|
3771
3791
|
|
|
3772
3792
|
> **debug**(`message?`, ...`optionalParams`): `void`
|
|
3773
3793
|
|
|
3774
|
-
Defined in: [lib/core.ts:
|
|
3794
|
+
Defined in: [lib/core.ts:1514](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1514)
|
|
3775
3795
|
|
|
3776
3796
|
打印调试信息,线上环境不会打印
|
|
3777
3797
|
|
|
@@ -3806,7 +3826,7 @@ lib/core/functions/display.md
|
|
|
3806
3826
|
|
|
3807
3827
|
> **display**(`message?`, ...`optionalParams`): `void`
|
|
3808
3828
|
|
|
3809
|
-
Defined in: [lib/core.ts:
|
|
3829
|
+
Defined in: [lib/core.ts:1527](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1527)
|
|
3810
3830
|
|
|
3811
3831
|
向控制台直接显示内容,一般情况下禁止使用
|
|
3812
3832
|
|
|
@@ -3918,7 +3938,7 @@ lib/core/functions/getLog.md
|
|
|
3918
3938
|
|
|
3919
3939
|
> **getLog**(`opt`): `Promise`\<`false` \| \{ `list`: `any`[] \| `string`[][]; `total`: `number`; \}\>
|
|
3920
3940
|
|
|
3921
|
-
Defined in: [lib/core.ts:
|
|
3941
|
+
Defined in: [lib/core.ts:1248](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1248)
|
|
3922
3942
|
|
|
3923
3943
|
获取日志内容为一个数组
|
|
3924
3944
|
|
|
@@ -3987,7 +4007,7 @@ lib/core/functions/getMonitorEvent.md
|
|
|
3987
4007
|
|
|
3988
4008
|
> **getMonitorEvent**(`opt`): `Promise`\<`false` \| [`IMonitorEvent`](../interfaces/IMonitorEvent.md) \| `null`\>
|
|
3989
4009
|
|
|
3990
|
-
Defined in: [lib/core.ts:
|
|
4010
|
+
Defined in: [lib/core.ts:1384](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1384)
|
|
3991
4011
|
|
|
3992
4012
|
读取事件详情和文件清单;只解析事件记录,不解析 Profile 或堆快照
|
|
3993
4013
|
|
|
@@ -4024,7 +4044,7 @@ lib/core/functions/getMonitorEvents.md
|
|
|
4024
4044
|
|
|
4025
4045
|
> **getMonitorEvents**(`opt?`): `Promise`\<`false` \| \{ `list`: [`IMonitorEventSummary`](../interfaces/IMonitorEventSummary.md)[]; `total`: `number`; \}\>
|
|
4026
4046
|
|
|
4027
|
-
Defined in: [lib/core.ts:
|
|
4047
|
+
Defined in: [lib/core.ts:1357](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1357)
|
|
4028
4048
|
|
|
4029
4049
|
获取某天已保存的监控事件,按目录时间倒序分页
|
|
4030
4050
|
|
|
@@ -4071,7 +4091,7 @@ lib/core/functions/getMonitorFile.md
|
|
|
4071
4091
|
|
|
4072
4092
|
> **getMonitorFile**(`opt`): `Promise`\<`false` \| [`Response`](../../undici/response/classes/Response.md) \| `null`\>
|
|
4073
4093
|
|
|
4074
|
-
Defined in: [lib/core.ts:
|
|
4094
|
+
Defined in: [lib/core.ts:1408](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1408)
|
|
4075
4095
|
|
|
4076
4096
|
获取监控原始文件的响应,可使用 getStream() 下载;小文件可用 getText()/getJson() 预览
|
|
4077
4097
|
|
|
@@ -4216,7 +4236,7 @@ lib/core/functions/loadEnv.md
|
|
|
4216
4236
|
|
|
4217
4237
|
> **loadEnv**(`dir`): `Promise`\<`void`\>
|
|
4218
4238
|
|
|
4219
|
-
Defined in: [lib/core.ts:
|
|
4239
|
+
Defined in: [lib/core.ts:1598](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1598)
|
|
4220
4240
|
|
|
4221
4241
|
加载 .env 文件到 process.env,若文件不存在则跳过
|
|
4222
4242
|
|
|
@@ -4245,7 +4265,7 @@ lib/core/functions/log.md
|
|
|
4245
4265
|
|
|
4246
4266
|
> **log**(`opt`, `msg`, `fend?`): `void`
|
|
4247
4267
|
|
|
4248
|
-
Defined in: [lib/core.ts:
|
|
4268
|
+
Defined in: [lib/core.ts:1135](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1135)
|
|
4249
4269
|
|
|
4250
4270
|
写入文件日志
|
|
4251
4271
|
|
|
@@ -4286,7 +4306,7 @@ lib/core/functions/ls.md
|
|
|
4286
4306
|
|
|
4287
4307
|
> **ls**(`opt`): `Promise`\<`object`[]\>
|
|
4288
4308
|
|
|
4289
|
-
Defined in: [lib/core.ts:
|
|
4309
|
+
Defined in: [lib/core.ts:1429](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1429)
|
|
4290
4310
|
|
|
4291
4311
|
获取目录内文件/文件夹列表
|
|
4292
4312
|
|
|
@@ -4656,7 +4676,7 @@ lib/core/functions/removeGlobal.md
|
|
|
4656
4676
|
|
|
4657
4677
|
> **removeGlobal**(`key`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
4658
4678
|
|
|
4659
|
-
Defined in: [lib/core.ts:
|
|
4679
|
+
Defined in: [lib/core.ts:977](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L977)
|
|
4660
4680
|
|
|
4661
4681
|
移除某个跨线程/跨内网服务器全局变量
|
|
4662
4682
|
|
|
@@ -4691,7 +4711,7 @@ lib/core/functions/resolveEnvVars.md
|
|
|
4691
4711
|
|
|
4692
4712
|
> **resolveEnvVars**(`obj`): `void`
|
|
4693
4713
|
|
|
4694
|
-
Defined in: [lib/core.ts:
|
|
4714
|
+
Defined in: [lib/core.ts:1628](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1628)
|
|
4695
4715
|
|
|
4696
4716
|
将配置对象中的 ${ENV_VAR} 占位符替换为 process.env 的值
|
|
4697
4717
|
|
|
@@ -4720,7 +4740,7 @@ lib/core/functions/sendNpm.md
|
|
|
4720
4740
|
|
|
4721
4741
|
> **sendNpm**(`path`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
4722
4742
|
|
|
4723
|
-
Defined in: [lib/core.ts:
|
|
4743
|
+
Defined in: [lib/core.ts:890](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L890)
|
|
4724
4744
|
|
|
4725
4745
|
向本机或局域网 RPC 发送 npm install 操作
|
|
4726
4746
|
|
|
@@ -4755,7 +4775,7 @@ lib/core/functions/sendPackage.md
|
|
|
4755
4775
|
|
|
4756
4776
|
> **sendPackage**(`content`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
4757
4777
|
|
|
4758
|
-
Defined in: [lib/core.ts:
|
|
4778
|
+
Defined in: [lib/core.ts:1082](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1082)
|
|
4759
4779
|
|
|
4760
4780
|
向本机或局域网 RPC 发送 package.json 更新操作
|
|
4761
4781
|
|
|
@@ -4790,7 +4810,7 @@ lib/core/functions/sendPm2.md
|
|
|
4790
4810
|
|
|
4791
4811
|
> **sendPm2**(`name`, `action?`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
4792
4812
|
|
|
4793
|
-
Defined in: [lib/core.ts:
|
|
4813
|
+
Defined in: [lib/core.ts:849](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L849)
|
|
4794
4814
|
|
|
4795
4815
|
向本机或局域网 RPC 发送 PM2 操作
|
|
4796
4816
|
|
|
@@ -4833,7 +4853,7 @@ lib/core/functions/sendProject.md
|
|
|
4833
4853
|
|
|
4834
4854
|
> **sendProject**(`path`, `key`, `value`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
4835
4855
|
|
|
4836
|
-
Defined in: [lib/core.ts:
|
|
4856
|
+
Defined in: [lib/core.ts:1041](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1041)
|
|
4837
4857
|
|
|
4838
4858
|
向本机或局域网 RPC 发送项目配置更新操作
|
|
4839
4859
|
|
|
@@ -4908,7 +4928,7 @@ lib/core/functions/sendRestart.md
|
|
|
4908
4928
|
|
|
4909
4929
|
> **sendRestart**(`hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
4910
4930
|
|
|
4911
|
-
Defined in: [lib/core.ts:
|
|
4931
|
+
Defined in: [lib/core.ts:754](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L754)
|
|
4912
4932
|
|
|
4913
4933
|
向主进程(或局域网同代码机子)发送广播将进行 restart 操作,停止监听并启动新进程,老进程在连接全部断开后自行销毁
|
|
4914
4934
|
主要用作不间断的代码热更新
|
|
@@ -4936,7 +4956,7 @@ lib/core/functions/sendStop.md
|
|
|
4936
4956
|
|
|
4937
4957
|
> **sendStop**(`hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
4938
4958
|
|
|
4939
|
-
Defined in: [lib/core.ts:
|
|
4959
|
+
Defined in: [lib/core.ts:799](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L799)
|
|
4940
4960
|
|
|
4941
4961
|
向主进程(或局域网同代码机子)发送 stop 操作,停止接收新连接并在现有连接全部结束后退出
|
|
4942
4962
|
|
|
@@ -5014,7 +5034,7 @@ lib/core/functions/setGlobal.md
|
|
|
5014
5034
|
|
|
5015
5035
|
> **setGlobal**(`key`, `data`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
5016
5036
|
|
|
5017
|
-
Defined in: [lib/core.ts:
|
|
5037
|
+
Defined in: [lib/core.ts:934](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L934)
|
|
5018
5038
|
|
|
5019
5039
|
设置跨线程/指定的局域网主机的全局变量
|
|
5020
5040
|
|
|
@@ -5113,7 +5133,7 @@ lib/core/functions/updateCode.md
|
|
|
5113
5133
|
|
|
5114
5134
|
> **updateCode**(`sourcePath`, `path`, `hosts?`, `config?`, `strict?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
|
|
5115
5135
|
|
|
5116
|
-
Defined in: [lib/core.ts:
|
|
5136
|
+
Defined in: [lib/core.ts:992](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L992)
|
|
5117
5137
|
|
|
5118
5138
|
上传并覆盖代码文件,config.json、kebab.json、.js.map、.ts, .gitignore 不会被覆盖和新创建
|
|
5119
5139
|
|
|
@@ -5166,7 +5186,7 @@ lib/core/functions/writeEventStreamHead.md
|
|
|
5166
5186
|
|
|
5167
5187
|
> **writeEventStreamHead**(`res`): `void`
|
|
5168
5188
|
|
|
5169
|
-
Defined in: [lib/core.ts:
|
|
5189
|
+
Defined in: [lib/core.ts:1568](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1568)
|
|
5170
5190
|
|
|
5171
5191
|
提交服务器发送事件(SSE)响应头
|
|
5172
5192
|
|
|
@@ -5201,7 +5221,7 @@ lib/core/functions/writeHead.md
|
|
|
5201
5221
|
|
|
5202
5222
|
> **writeHead**(`res`, `statusCode`, `headers?`): `void`
|
|
5203
5223
|
|
|
5204
|
-
Defined in: [lib/core.ts:
|
|
5224
|
+
Defined in: [lib/core.ts:1547](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1547)
|
|
5205
5225
|
|
|
5206
5226
|
提交 HTTP 响应状态和头部,兼容 HTTP/1.1 与 HTTP/2
|
|
5207
5227
|
|
|
@@ -5251,7 +5271,7 @@ lib/core/functions/write.md
|
|
|
5251
5271
|
|
|
5252
5272
|
> **write**(`res`, `data`): `void`
|
|
5253
5273
|
|
|
5254
|
-
Defined in: [lib/core.ts:
|
|
5274
|
+
Defined in: [lib/core.ts:1580](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1580)
|
|
5255
5275
|
|
|
5256
5276
|
向 res 发送数据
|
|
5257
5277
|
|
|
@@ -5437,7 +5457,7 @@ lib/core/interfaces/ILogOptions.md
|
|
|
5437
5457
|
|
|
5438
5458
|
# Interface: ILogOptions
|
|
5439
5459
|
|
|
5440
|
-
Defined in: [lib/core.ts:
|
|
5460
|
+
Defined in: [lib/core.ts:1118](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1118)
|
|
5441
5461
|
|
|
5442
5462
|
log 设置的选项
|
|
5443
5463
|
|
|
@@ -5447,7 +5467,7 @@ log 设置的选项
|
|
|
5447
5467
|
|
|
5448
5468
|
> `optional` **cookie?**: `Record`\<`string`, `string`\>
|
|
5449
5469
|
|
|
5450
|
-
Defined in: [lib/core.ts:
|
|
5470
|
+
Defined in: [lib/core.ts:1124](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1124)
|
|
5451
5471
|
|
|
5452
5472
|
***
|
|
5453
5473
|
|
|
@@ -5455,7 +5475,7 @@ Defined in: [lib/core.ts:1197](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5455
5475
|
|
|
5456
5476
|
> `optional` **get?**: `Record`\<`string`, `any`\>
|
|
5457
5477
|
|
|
5458
|
-
Defined in: [lib/core.ts:
|
|
5478
|
+
Defined in: [lib/core.ts:1123](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1123)
|
|
5459
5479
|
|
|
5460
5480
|
***
|
|
5461
5481
|
|
|
@@ -5463,7 +5483,7 @@ Defined in: [lib/core.ts:1196](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5463
5483
|
|
|
5464
5484
|
> `optional` **headers?**: `IncomingHttpHeaders`
|
|
5465
5485
|
|
|
5466
|
-
Defined in: [lib/core.ts:
|
|
5486
|
+
Defined in: [lib/core.ts:1126](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1126)
|
|
5467
5487
|
|
|
5468
5488
|
***
|
|
5469
5489
|
|
|
@@ -5471,7 +5491,7 @@ Defined in: [lib/core.ts:1199](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5471
5491
|
|
|
5472
5492
|
> `optional` **hostname?**: `string`
|
|
5473
5493
|
|
|
5474
|
-
Defined in: [lib/core.ts:
|
|
5494
|
+
Defined in: [lib/core.ts:1121](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1121)
|
|
5475
5495
|
|
|
5476
5496
|
***
|
|
5477
5497
|
|
|
@@ -5479,7 +5499,7 @@ Defined in: [lib/core.ts:1194](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5479
5499
|
|
|
5480
5500
|
> `optional` **path?**: `string`
|
|
5481
5501
|
|
|
5482
|
-
Defined in: [lib/core.ts:
|
|
5502
|
+
Defined in: [lib/core.ts:1119](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1119)
|
|
5483
5503
|
|
|
5484
5504
|
***
|
|
5485
5505
|
|
|
@@ -5487,7 +5507,7 @@ Defined in: [lib/core.ts:1192](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5487
5507
|
|
|
5488
5508
|
> `optional` **req?**: `IncomingMessage` \| `Http2ServerRequest` \| `null`
|
|
5489
5509
|
|
|
5490
|
-
Defined in: [lib/core.ts:
|
|
5510
|
+
Defined in: [lib/core.ts:1122](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1122)
|
|
5491
5511
|
|
|
5492
5512
|
***
|
|
5493
5513
|
|
|
@@ -5495,7 +5515,7 @@ Defined in: [lib/core.ts:1195](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5495
5515
|
|
|
5496
5516
|
> `optional` **session?**: `Record`\<`string`, `any`\>
|
|
5497
5517
|
|
|
5498
|
-
Defined in: [lib/core.ts:
|
|
5518
|
+
Defined in: [lib/core.ts:1125](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1125)
|
|
5499
5519
|
|
|
5500
5520
|
***
|
|
5501
5521
|
|
|
@@ -5503,7 +5523,7 @@ Defined in: [lib/core.ts:1198](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5503
5523
|
|
|
5504
5524
|
> `optional` **urlFull?**: `string`
|
|
5505
5525
|
|
|
5506
|
-
Defined in: [lib/core.ts:
|
|
5526
|
+
Defined in: [lib/core.ts:1120](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1120)
|
|
5507
5527
|
|
|
5508
5528
|
lib/core/interfaces/IMonitorEvent.md
|
|
5509
5529
|
---
|
|
@@ -5516,7 +5536,7 @@ lib/core/interfaces/IMonitorEvent.md
|
|
|
5516
5536
|
|
|
5517
5537
|
# Interface: IMonitorEvent
|
|
5518
5538
|
|
|
5519
|
-
Defined in: [lib/core.ts:
|
|
5539
|
+
Defined in: [lib/core.ts:1314](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1314)
|
|
5520
5540
|
|
|
5521
5541
|
事件原始数据与可读取的文件;data 为 null 时可下载原始记录复盘
|
|
5522
5542
|
|
|
@@ -5526,7 +5546,7 @@ Defined in: [lib/core.ts:1387](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5526
5546
|
|
|
5527
5547
|
> **data**: `Record`\<`string`, `unknown`\> \| `null`
|
|
5528
5548
|
|
|
5529
|
-
Defined in: [lib/core.ts:
|
|
5549
|
+
Defined in: [lib/core.ts:1316](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1316)
|
|
5530
5550
|
|
|
5531
5551
|
***
|
|
5532
5552
|
|
|
@@ -5534,7 +5554,7 @@ Defined in: [lib/core.ts:1389](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5534
5554
|
|
|
5535
5555
|
> **files**: [`IMonitorFile`](IMonitorFile.md)[]
|
|
5536
5556
|
|
|
5537
|
-
Defined in: [lib/core.ts:
|
|
5557
|
+
Defined in: [lib/core.ts:1318](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1318)
|
|
5538
5558
|
|
|
5539
5559
|
***
|
|
5540
5560
|
|
|
@@ -5542,7 +5562,7 @@ Defined in: [lib/core.ts:1391](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5542
5562
|
|
|
5543
5563
|
> **recordStatus**: `"loaded"` \| `"invalid"` \| `"missing"` \| `"too-large"` \| `"unreadable"`
|
|
5544
5564
|
|
|
5545
|
-
Defined in: [lib/core.ts:
|
|
5565
|
+
Defined in: [lib/core.ts:1317](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1317)
|
|
5546
5566
|
|
|
5547
5567
|
***
|
|
5548
5568
|
|
|
@@ -5550,7 +5570,7 @@ Defined in: [lib/core.ts:1390](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5550
5570
|
|
|
5551
5571
|
> **summary**: [`IMonitorEventSummary`](IMonitorEventSummary.md)
|
|
5552
5572
|
|
|
5553
|
-
Defined in: [lib/core.ts:
|
|
5573
|
+
Defined in: [lib/core.ts:1315](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1315)
|
|
5554
5574
|
|
|
5555
5575
|
lib/core/interfaces/IMonitorEventSummary.md
|
|
5556
5576
|
---
|
|
@@ -5563,7 +5583,7 @@ lib/core/interfaces/IMonitorEventSummary.md
|
|
|
5563
5583
|
|
|
5564
5584
|
# Interface: IMonitorEventSummary
|
|
5565
5585
|
|
|
5566
|
-
Defined in: [lib/core.ts:
|
|
5586
|
+
Defined in: [lib/core.ts:1294](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1294)
|
|
5567
5587
|
|
|
5568
5588
|
已保存监控事件的简短摘要,path 相对于 log/monitor/
|
|
5569
5589
|
|
|
@@ -5573,7 +5593,7 @@ Defined in: [lib/core.ts:1367](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5573
5593
|
|
|
5574
5594
|
> **path**: `string`
|
|
5575
5595
|
|
|
5576
|
-
Defined in: [lib/core.ts:
|
|
5596
|
+
Defined in: [lib/core.ts:1295](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1295)
|
|
5577
5597
|
|
|
5578
5598
|
***
|
|
5579
5599
|
|
|
@@ -5581,7 +5601,7 @@ Defined in: [lib/core.ts:1368](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5581
5601
|
|
|
5582
5602
|
> **pid**: `number`
|
|
5583
5603
|
|
|
5584
|
-
Defined in: [lib/core.ts:
|
|
5604
|
+
Defined in: [lib/core.ts:1296](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1296)
|
|
5585
5605
|
|
|
5586
5606
|
***
|
|
5587
5607
|
|
|
@@ -5589,7 +5609,7 @@ Defined in: [lib/core.ts:1369](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5589
5609
|
|
|
5590
5610
|
> **reasons**: `string`[]
|
|
5591
5611
|
|
|
5592
|
-
Defined in: [lib/core.ts:
|
|
5612
|
+
Defined in: [lib/core.ts:1300](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1300)
|
|
5593
5613
|
|
|
5594
5614
|
***
|
|
5595
5615
|
|
|
@@ -5597,7 +5617,7 @@ Defined in: [lib/core.ts:1373](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5597
5617
|
|
|
5598
5618
|
> **source**: `"main"` \| `"watchdog"`
|
|
5599
5619
|
|
|
5600
|
-
Defined in: [lib/core.ts:
|
|
5620
|
+
Defined in: [lib/core.ts:1298](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1298)
|
|
5601
5621
|
|
|
5602
5622
|
***
|
|
5603
5623
|
|
|
@@ -5605,7 +5625,7 @@ Defined in: [lib/core.ts:1371](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5605
5625
|
|
|
5606
5626
|
> **status**: `string`
|
|
5607
5627
|
|
|
5608
|
-
Defined in: [lib/core.ts:
|
|
5628
|
+
Defined in: [lib/core.ts:1299](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1299)
|
|
5609
5629
|
|
|
5610
5630
|
***
|
|
5611
5631
|
|
|
@@ -5613,7 +5633,7 @@ Defined in: [lib/core.ts:1372](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5613
5633
|
|
|
5614
5634
|
> **time**: `number`
|
|
5615
5635
|
|
|
5616
|
-
Defined in: [lib/core.ts:
|
|
5636
|
+
Defined in: [lib/core.ts:1297](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1297)
|
|
5617
5637
|
|
|
5618
5638
|
lib/core/interfaces/IMonitorFile.md
|
|
5619
5639
|
---
|
|
@@ -5626,7 +5646,7 @@ lib/core/interfaces/IMonitorFile.md
|
|
|
5626
5646
|
|
|
5627
5647
|
# Interface: IMonitorFile
|
|
5628
5648
|
|
|
5629
|
-
Defined in: [lib/core.ts:
|
|
5649
|
+
Defined in: [lib/core.ts:1304](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1304)
|
|
5630
5650
|
|
|
5631
5651
|
监控文件元数据;复杂格式或超过 1 MiB 的文件不提供预览
|
|
5632
5652
|
|
|
@@ -5636,7 +5656,7 @@ Defined in: [lib/core.ts:1377](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5636
5656
|
|
|
5637
5657
|
> **mtime**: `number`
|
|
5638
5658
|
|
|
5639
|
-
Defined in: [lib/core.ts:
|
|
5659
|
+
Defined in: [lib/core.ts:1309](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1309)
|
|
5640
5660
|
|
|
5641
5661
|
最后修改时间,单位 ms
|
|
5642
5662
|
|
|
@@ -5646,7 +5666,7 @@ Defined in: [lib/core.ts:1382](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5646
5666
|
|
|
5647
5667
|
> **name**: `string`
|
|
5648
5668
|
|
|
5649
|
-
Defined in: [lib/core.ts:
|
|
5669
|
+
Defined in: [lib/core.ts:1306](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1306)
|
|
5650
5670
|
|
|
5651
5671
|
***
|
|
5652
5672
|
|
|
@@ -5654,7 +5674,7 @@ Defined in: [lib/core.ts:1379](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5654
5674
|
|
|
5655
5675
|
> **path**: `string`
|
|
5656
5676
|
|
|
5657
|
-
Defined in: [lib/core.ts:
|
|
5677
|
+
Defined in: [lib/core.ts:1305](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1305)
|
|
5658
5678
|
|
|
5659
5679
|
***
|
|
5660
5680
|
|
|
@@ -5662,7 +5682,7 @@ Defined in: [lib/core.ts:1378](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5662
5682
|
|
|
5663
5683
|
> **preview**: `"text"` \| `"json"` \| `null`
|
|
5664
5684
|
|
|
5665
|
-
Defined in: [lib/core.ts:
|
|
5685
|
+
Defined in: [lib/core.ts:1310](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1310)
|
|
5666
5686
|
|
|
5667
5687
|
***
|
|
5668
5688
|
|
|
@@ -5670,7 +5690,7 @@ Defined in: [lib/core.ts:1383](https://github.com/maiyunnet/kebab/blob/master/li
|
|
|
5670
5690
|
|
|
5671
5691
|
> **size**: `number`
|
|
5672
5692
|
|
|
5673
|
-
Defined in: [lib/core.ts:
|
|
5693
|
+
Defined in: [lib/core.ts:1307](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1307)
|
|
5674
5694
|
|
|
5675
5695
|
lib/core/namespaces/v/classes/ValiError.md
|
|
5676
5696
|
---
|
|
@@ -114901,7 +114921,7 @@ lib/core/type-aliases/TPm2Action.md
|
|
|
114901
114921
|
|
|
114902
114922
|
> **TPm2Action** = `"start"` \| `"stop"` \| `"restart"`
|
|
114903
114923
|
|
|
114904
|
-
Defined in: [lib/core.ts:
|
|
114924
|
+
Defined in: [lib/core.ts:840](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L840)
|
|
114905
114925
|
|
|
114906
114926
|
PM2 操作类型
|
|
114907
114927
|
|
|
@@ -114975,7 +114995,7 @@ lib/core/variables/global.md
|
|
|
114975
114995
|
|
|
114976
114996
|
> `const` **global**: `Record`\<`string`, `any`\> = `{}`
|
|
114977
114997
|
|
|
114978
|
-
Defined in: [lib/core.ts:
|
|
114998
|
+
Defined in: [lib/core.ts:926](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L926)
|
|
114979
114999
|
|
|
114980
115000
|
跨进程全局变量
|
|
114981
115001
|
|
|
@@ -126473,7 +126493,7 @@ lib/text/functions/compareVersion.md
|
|
|
126473
126493
|
|
|
126474
126494
|
> **compareVersion**(`version`, `target`): `0` \| `1` \| `-1` \| `null`
|
|
126475
126495
|
|
|
126476
|
-
Defined in: [lib/text.ts:
|
|
126496
|
+
Defined in: [lib/text.ts:36](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L36)
|
|
126477
126497
|
|
|
126478
126498
|
逐段比较三段正式发行版本 X.Y.Z,不按字符串或浮点数比较
|
|
126479
126499
|
|
|
@@ -126510,7 +126530,7 @@ lib/text/functions/csvescape.md
|
|
|
126510
126530
|
|
|
126511
126531
|
> **csvescape**(`str`): `string`
|
|
126512
126532
|
|
|
126513
|
-
Defined in: [lib/text.ts:
|
|
126533
|
+
Defined in: [lib/text.ts:586](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L586)
|
|
126514
126534
|
|
|
126515
126535
|
CSV 特殊字符转换为实体字符
|
|
126516
126536
|
|
|
@@ -126537,7 +126557,7 @@ lib/text/functions/getFileExt.md
|
|
|
126537
126557
|
|
|
126538
126558
|
> **getFileExt**(`path`): `string`
|
|
126539
126559
|
|
|
126540
|
-
Defined in: [lib/text.ts:
|
|
126560
|
+
Defined in: [lib/text.ts:627](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L627)
|
|
126541
126561
|
|
|
126542
126562
|
获取文件后缀
|
|
126543
126563
|
|
|
@@ -126566,7 +126586,7 @@ lib/text/functions/getFileNameExt.md
|
|
|
126566
126586
|
|
|
126567
126587
|
> **getFileNameExt**(`path`): `object`
|
|
126568
126588
|
|
|
126569
|
-
Defined in: [lib/text.ts:
|
|
126589
|
+
Defined in: [lib/text.ts:640](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L640)
|
|
126570
126590
|
|
|
126571
126591
|
获取文件名和后缀
|
|
126572
126592
|
|
|
@@ -126603,7 +126623,7 @@ lib/text/functions/getFilename.md
|
|
|
126603
126623
|
|
|
126604
126624
|
> **getFilename**(`path`, `ext?`): `string`
|
|
126605
126625
|
|
|
126606
|
-
Defined in: [lib/text.ts:
|
|
126626
|
+
Defined in: [lib/text.ts:607](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L607)
|
|
126607
126627
|
|
|
126608
126628
|
获取文件名
|
|
126609
126629
|
|
|
@@ -126638,7 +126658,7 @@ lib/text/functions/htmlescape.md
|
|
|
126638
126658
|
|
|
126639
126659
|
> **htmlescape**(`html`): `string`
|
|
126640
126660
|
|
|
126641
|
-
Defined in: [lib/text.ts:
|
|
126661
|
+
Defined in: [lib/text.ts:572](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L572)
|
|
126642
126662
|
|
|
126643
126663
|
HTML 特殊字符转换为实体字符
|
|
126644
126664
|
|
|
@@ -126667,7 +126687,7 @@ lib/text/functions/int2str.md
|
|
|
126667
126687
|
|
|
126668
126688
|
> **int2str**(`int`, `digits?`, `decimal?`): `string`
|
|
126669
126689
|
|
|
126670
|
-
Defined in: [lib/text.ts:
|
|
126690
|
+
Defined in: [lib/text.ts:840](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L840)
|
|
126671
126691
|
|
|
126672
126692
|
为解决精度问题,将整数转换为小数字符串
|
|
126673
126693
|
以下几个示例都是当 digits 为 3、decimal 为 2 时
|
|
@@ -126713,7 +126733,7 @@ lib/text/functions/isAscii.md
|
|
|
126713
126733
|
|
|
126714
126734
|
> **isAscii**(`text`): `boolean`
|
|
126715
126735
|
|
|
126716
|
-
Defined in: [lib/text.ts:
|
|
126736
|
+
Defined in: [lib/text.ts:330](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L330)
|
|
126717
126737
|
|
|
126718
126738
|
判断是否在 ascii 字符集内,仅可输入部分
|
|
126719
126739
|
|
|
@@ -126742,7 +126762,7 @@ lib/text/functions/isDomain.md
|
|
|
126742
126762
|
|
|
126743
126763
|
> **isDomain**(`domain`): `boolean`
|
|
126744
126764
|
|
|
126745
|
-
Defined in: [lib/text.ts:
|
|
126765
|
+
Defined in: [lib/text.ts:319](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L319)
|
|
126746
126766
|
|
|
126747
126767
|
判断是否是域名
|
|
126748
126768
|
|
|
@@ -126773,7 +126793,7 @@ lib/text/functions/isEMail.md
|
|
|
126773
126793
|
|
|
126774
126794
|
> **isEMail**(`email`): `boolean`
|
|
126775
126795
|
|
|
126776
|
-
Defined in: [lib/text.ts:
|
|
126796
|
+
Defined in: [lib/text.ts:292](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L292)
|
|
126777
126797
|
|
|
126778
126798
|
是否是邮件地址
|
|
126779
126799
|
|
|
@@ -126800,7 +126820,7 @@ lib/text/functions/isFalsy.md
|
|
|
126800
126820
|
|
|
126801
126821
|
> **isFalsy**(`val`): `val is TFalsy`
|
|
126802
126822
|
|
|
126803
|
-
Defined in: [lib/text.ts:
|
|
126823
|
+
Defined in: [lib/text.ts:791](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L791)
|
|
126804
126824
|
|
|
126805
126825
|
判断一个值是否是虚假的(为 null/undefined/空字符串/false/0)
|
|
126806
126826
|
|
|
@@ -126829,7 +126849,7 @@ lib/text/functions/isIdCardCN.md
|
|
|
126829
126849
|
|
|
126830
126850
|
> **isIdCardCN**(`idcard`): `boolean`
|
|
126831
126851
|
|
|
126832
|
-
Defined in: [lib/text.ts:
|
|
126852
|
+
Defined in: [lib/text.ts:442](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L442)
|
|
126833
126853
|
|
|
126834
126854
|
是否是中国大陆身份证号码
|
|
126835
126855
|
|
|
@@ -126858,9 +126878,9 @@ lib/text/functions/isIPv4.md
|
|
|
126858
126878
|
|
|
126859
126879
|
> **isIPv4**(`ip`): `boolean`
|
|
126860
126880
|
|
|
126861
|
-
Defined in: [lib/text.ts:
|
|
126881
|
+
Defined in: [lib/text.ts:300](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L300)
|
|
126862
126882
|
|
|
126863
|
-
是否是 IPv4(基于 Node 原生 net.
|
|
126883
|
+
是否是 IPv4(基于 Node 原生 net.isIPv4,严格校验)
|
|
126864
126884
|
|
|
126865
126885
|
## Parameters
|
|
126866
126886
|
|
|
@@ -126885,9 +126905,9 @@ lib/text/functions/isIPv6.md
|
|
|
126885
126905
|
|
|
126886
126906
|
> **isIPv6**(`ip`): `boolean`
|
|
126887
126907
|
|
|
126888
|
-
Defined in: [lib/text.ts:
|
|
126908
|
+
Defined in: [lib/text.ts:308](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L308)
|
|
126889
126909
|
|
|
126890
|
-
是否是 IPv6(基于 Node 原生 net.
|
|
126910
|
+
是否是 IPv6(基于 Node 原生 net.isIPv6,严格校验)
|
|
126891
126911
|
|
|
126892
126912
|
## Parameters
|
|
126893
126913
|
|
|
@@ -126912,7 +126932,7 @@ lib/text/functions/isPhoneCN.md
|
|
|
126912
126932
|
|
|
126913
126933
|
> **isPhoneCN**(`p`): `boolean`
|
|
126914
126934
|
|
|
126915
|
-
Defined in: [lib/text.ts:
|
|
126935
|
+
Defined in: [lib/text.ts:434](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L434)
|
|
126916
126936
|
|
|
126917
126937
|
判断手机号是否是 11 位,不做真实性校验
|
|
126918
126938
|
|
|
@@ -126941,7 +126961,7 @@ lib/text/functions/isRealPath.md
|
|
|
126941
126961
|
|
|
126942
126962
|
> **isRealPath**(`path`): `boolean`
|
|
126943
126963
|
|
|
126944
|
-
Defined in: [lib/text.ts:
|
|
126964
|
+
Defined in: [lib/text.ts:594](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L594)
|
|
126945
126965
|
|
|
126946
126966
|
判断是否是绝对路径,是返回 true,相对路径返回 false
|
|
126947
126967
|
|
|
@@ -126970,7 +126990,7 @@ lib/text/functions/isSameOrigin.md
|
|
|
126970
126990
|
|
|
126971
126991
|
> **isSameOrigin**(`from`, `to`): `boolean`
|
|
126972
126992
|
|
|
126973
|
-
Defined in: [lib/text.ts:
|
|
126993
|
+
Defined in: [lib/text.ts:173](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L173)
|
|
126974
126994
|
|
|
126975
126995
|
判断两个 URL 是否属于同源地址
|
|
126976
126996
|
|
|
@@ -127005,7 +127025,7 @@ lib/text/functions/isTruthy.md
|
|
|
127005
127025
|
|
|
127006
127026
|
> **isTruthy**\<`T`\>(`val`): `val is Exclude<T, TFalsy>`
|
|
127007
127027
|
|
|
127008
|
-
Defined in: [lib/text.ts:
|
|
127028
|
+
Defined in: [lib/text.ts:799](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L799)
|
|
127009
127029
|
|
|
127010
127030
|
判断一个值是否是真实的(不为 null/undefined/空字符串/false/0)
|
|
127011
127031
|
|
|
@@ -127040,7 +127060,7 @@ lib/text/functions/logicalOr.md
|
|
|
127040
127060
|
|
|
127041
127061
|
> **logicalOr**\<`T`, `T2`\>(`v1`, `v2`): `T` *extends* [`TFalsy`](../type-aliases/TFalsy.md) ? `T2` : `T`
|
|
127042
127062
|
|
|
127043
|
-
Defined in: [lib/text.ts:
|
|
127063
|
+
Defined in: [lib/text.ts:808](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L808)
|
|
127044
127064
|
|
|
127045
127065
|
类似 || 运算符的效果
|
|
127046
127066
|
|
|
@@ -127085,7 +127105,7 @@ lib/text/functions/match.md
|
|
|
127085
127105
|
|
|
127086
127106
|
> **match**(`str`, `regs`): `boolean`
|
|
127087
127107
|
|
|
127088
|
-
Defined in: [lib/text.ts:
|
|
127108
|
+
Defined in: [lib/text.ts:419](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L419)
|
|
127089
127109
|
|
|
127090
127110
|
传入正则进行匹配 str 是否有一项满足
|
|
127091
127111
|
|
|
@@ -127120,7 +127140,7 @@ lib/text/functions/nlReplace.md
|
|
|
127120
127140
|
|
|
127121
127141
|
> **nlReplace**(`str`, `to?`): `string`
|
|
127122
127142
|
|
|
127123
|
-
Defined in: [lib/text.ts:
|
|
127143
|
+
Defined in: [lib/text.ts:339](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L339)
|
|
127124
127144
|
|
|
127125
127145
|
换行替换为别的
|
|
127126
127146
|
|
|
@@ -127155,7 +127175,7 @@ lib/text/functions/parseDomain.md
|
|
|
127155
127175
|
|
|
127156
127176
|
> **parseDomain**(`domain`): `Promise`\<[`IDomain`](../interfaces/IDomain.md)\>
|
|
127157
127177
|
|
|
127158
|
-
Defined in: [lib/text.ts:
|
|
127178
|
+
Defined in: [lib/text.ts:362](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L362)
|
|
127159
127179
|
|
|
127160
127180
|
解析域名并获取 tld/sld/domain/sub
|
|
127161
127181
|
|
|
@@ -127184,7 +127204,7 @@ lib/text/functions/parseHost.md
|
|
|
127184
127204
|
|
|
127185
127205
|
> **parseHost**(`host`): `object`
|
|
127186
127206
|
|
|
127187
|
-
Defined in: [lib/text.ts:
|
|
127207
|
+
Defined in: [lib/text.ts:69](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L69)
|
|
127188
127208
|
|
|
127189
127209
|
解析主机名和端口号
|
|
127190
127210
|
|
|
@@ -127225,9 +127245,9 @@ lib/text/functions/parseJson.md
|
|
|
127225
127245
|
|
|
127226
127246
|
> **parseJson**\<`T`\>(`str`): `false` \| `T`
|
|
127227
127247
|
|
|
127228
|
-
Defined in: [lib/text.ts:
|
|
127248
|
+
Defined in: [lib/text.ts:703](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L703)
|
|
127229
127249
|
|
|
127230
|
-
|
|
127250
|
+
解析 JSON,超出安全整数范围的整数字面量转换为 BigInt
|
|
127231
127251
|
|
|
127232
127252
|
## Type Parameters
|
|
127233
127253
|
|
|
@@ -127247,6 +127267,8 @@ Defined in: [lib/text.ts:701](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
127247
127267
|
|
|
127248
127268
|
`false` \| `T`
|
|
127249
127269
|
|
|
127270
|
+
解析结果,无效 JSON 返回 false;小数及指数形式仍为 number
|
|
127271
|
+
|
|
127250
127272
|
lib/text/functions/parseUrl.md
|
|
127251
127273
|
---
|
|
127252
127274
|
|
|
@@ -127260,7 +127282,7 @@ lib/text/functions/parseUrl.md
|
|
|
127260
127282
|
|
|
127261
127283
|
> **parseUrl**(`url`): [`IUrlParse`](../../../index/interfaces/IUrlParse.md)
|
|
127262
127284
|
|
|
127263
|
-
Defined in: [lib/text.ts:
|
|
127285
|
+
Defined in: [lib/text.ts:95](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L95)
|
|
127264
127286
|
|
|
127265
127287
|
格式化一段 URL
|
|
127266
127288
|
|
|
@@ -127287,7 +127309,7 @@ lib/text/functions/parseVersion.md
|
|
|
127287
127309
|
|
|
127288
127310
|
> **parseVersion**(`value`): \[`number`, `number`, `number`\] \| `null`
|
|
127289
127311
|
|
|
127290
|
-
Defined in: [lib/text.ts:
|
|
127312
|
+
Defined in: [lib/text.ts:17](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L17)
|
|
127291
127313
|
|
|
127292
127314
|
解析三段正式发行版本 X.Y.Z,不接受前导零、预发行和构建后缀
|
|
127293
127315
|
|
|
@@ -127318,7 +127340,7 @@ lib/text/functions/queryParse.md
|
|
|
127318
127340
|
|
|
127319
127341
|
> **queryParse**(`query`): `Record`\<`string`, `string` \| `string`[]\>
|
|
127320
127342
|
|
|
127321
|
-
Defined in: [lib/text.ts:
|
|
127343
|
+
Defined in: [lib/text.ts:519](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L519)
|
|
127322
127344
|
|
|
127323
127345
|
将 query string 转换为对象
|
|
127324
127346
|
|
|
@@ -127349,7 +127371,7 @@ lib/text/functions/queryStringify.md
|
|
|
127349
127371
|
|
|
127350
127372
|
> **queryStringify**(`query`, `encode?`): `string`
|
|
127351
127373
|
|
|
127352
|
-
Defined in: [lib/text.ts:
|
|
127374
|
+
Defined in: [lib/text.ts:470](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L470)
|
|
127353
127375
|
|
|
127354
127376
|
将对象转换为 query string
|
|
127355
127377
|
|
|
@@ -127375,7 +127397,7 @@ Defined in: [lib/text.ts:469](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
127375
127397
|
|
|
127376
127398
|
> **queryStringify**(`query`, `options`): `string`
|
|
127377
127399
|
|
|
127378
|
-
Defined in: [lib/text.ts:
|
|
127400
|
+
Defined in: [lib/text.ts:476](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L476)
|
|
127379
127401
|
|
|
127380
127402
|
将对象转换为 query string
|
|
127381
127403
|
|
|
@@ -127420,7 +127442,7 @@ lib/text/functions/sizeFormat.md
|
|
|
127420
127442
|
|
|
127421
127443
|
> **sizeFormat**(`size`, `spliter?`): `string`
|
|
127422
127444
|
|
|
127423
|
-
Defined in: [lib/text.ts:
|
|
127445
|
+
Defined in: [lib/text.ts:55](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L55)
|
|
127424
127446
|
|
|
127425
127447
|
将文件大小格式化为带单位的字符串
|
|
127426
127448
|
|
|
@@ -127455,7 +127477,7 @@ lib/text/functions/str2int.md
|
|
|
127455
127477
|
|
|
127456
127478
|
> **str2int**(`str`, `digits?`): `number`
|
|
127457
127479
|
|
|
127458
|
-
Defined in: [lib/text.ts:
|
|
127480
|
+
Defined in: [lib/text.ts:822](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L822)
|
|
127459
127481
|
|
|
127460
127482
|
为解决精度问题,将字符串数字转换为整数显示
|
|
127461
127483
|
以下几个示例都是当 digits 为 2 时
|
|
@@ -127495,7 +127517,7 @@ lib/text/functions/stringifyBuffer.md
|
|
|
127495
127517
|
|
|
127496
127518
|
> **stringifyBuffer**(`buf`): `string`
|
|
127497
127519
|
|
|
127498
|
-
Defined in: [lib/text.ts:
|
|
127520
|
+
Defined in: [lib/text.ts:745](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L745)
|
|
127499
127521
|
|
|
127500
127522
|
输出文本格式的 buffer
|
|
127501
127523
|
|
|
@@ -127524,7 +127546,7 @@ lib/text/functions/stringifyError.md
|
|
|
127524
127546
|
|
|
127525
127547
|
> **stringifyError**(`error`): `string`
|
|
127526
127548
|
|
|
127527
|
-
Defined in: [lib/text.ts:
|
|
127549
|
+
Defined in: [lib/text.ts:722](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L722)
|
|
127528
127550
|
|
|
127529
127551
|
将未知异常转换为适合单行日志的文本,Error 优先返回完整堆栈
|
|
127530
127552
|
|
|
@@ -127555,9 +127577,9 @@ lib/text/functions/stringifyJson.md
|
|
|
127555
127577
|
|
|
127556
127578
|
> **stringifyJson**(`obj`, `space?`): `string`
|
|
127557
127579
|
|
|
127558
|
-
Defined in: [lib/text.ts:
|
|
127580
|
+
Defined in: [lib/text.ts:713](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L713)
|
|
127559
127581
|
|
|
127560
|
-
将对象转换为
|
|
127582
|
+
将对象转换为 JSON 字符串,BigInt 输出为整数字面量
|
|
127561
127583
|
|
|
127562
127584
|
## Parameters
|
|
127563
127585
|
|
|
@@ -127577,6 +127599,8 @@ Defined in: [lib/text.ts:731](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
127577
127599
|
|
|
127578
127600
|
`string`
|
|
127579
127601
|
|
|
127602
|
+
JSON 字符串,循环引用等序列化错误沿用 JSON.stringify 异常
|
|
127603
|
+
|
|
127580
127604
|
lib/text/functions/stringifyResult.md
|
|
127581
127605
|
---
|
|
127582
127606
|
|
|
@@ -127590,7 +127614,7 @@ lib/text/functions/stringifyResult.md
|
|
|
127590
127614
|
|
|
127591
127615
|
> **stringifyResult**(`rtn`): `string`
|
|
127592
127616
|
|
|
127593
|
-
Defined in: [lib/text.ts:
|
|
127617
|
+
Defined in: [lib/text.ts:662](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L662)
|
|
127594
127618
|
|
|
127595
127619
|
将普通的返回 JSON 对象序列化为字符串
|
|
127596
127620
|
|
|
@@ -127619,7 +127643,7 @@ lib/text/functions/trimJson.md
|
|
|
127619
127643
|
|
|
127620
127644
|
> **trimJson**(`json`): `any`
|
|
127621
127645
|
|
|
127622
|
-
Defined in: [lib/text.ts:
|
|
127646
|
+
Defined in: [lib/text.ts:753](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L753)
|
|
127623
127647
|
|
|
127624
127648
|
递归删除 json 中的字符串首尾空格,会返回一个新的对象
|
|
127625
127649
|
|
|
@@ -127646,7 +127670,7 @@ lib/text/functions/urlAtom.md
|
|
|
127646
127670
|
|
|
127647
127671
|
> **urlAtom**(`url`): `string`
|
|
127648
127672
|
|
|
127649
|
-
Defined in: [lib/text.ts:
|
|
127673
|
+
Defined in: [lib/text.ts:273](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L273)
|
|
127650
127674
|
|
|
127651
127675
|
将路径中的 ../ ./ 都按规范妥善处理
|
|
127652
127676
|
|
|
@@ -127675,7 +127699,7 @@ lib/text/functions/urlResolve.md
|
|
|
127675
127699
|
|
|
127676
127700
|
> **urlResolve**(`from`, `to`, `limit?`): `string`
|
|
127677
127701
|
|
|
127678
|
-
Defined in: [lib/text.ts:
|
|
127702
|
+
Defined in: [lib/text.ts:207](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L207)
|
|
127679
127703
|
|
|
127680
127704
|
将相对路径根据基准路径进行转换
|
|
127681
127705
|
|
|
@@ -127779,7 +127803,7 @@ lib/text/interfaces/IDomain.md
|
|
|
127779
127803
|
|
|
127780
127804
|
# Interface: IDomain
|
|
127781
127805
|
|
|
127782
|
-
Defined in: [lib/text.ts:
|
|
127806
|
+
Defined in: [lib/text.ts:351](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L351)
|
|
127783
127807
|
|
|
127784
127808
|
解析后的 domain
|
|
127785
127809
|
|
|
@@ -127789,7 +127813,7 @@ Defined in: [lib/text.ts:350](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
127789
127813
|
|
|
127790
127814
|
> **domain**: `string` \| `null`
|
|
127791
127815
|
|
|
127792
|
-
Defined in: [lib/text.ts:
|
|
127816
|
+
Defined in: [lib/text.ts:354](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L354)
|
|
127793
127817
|
|
|
127794
127818
|
***
|
|
127795
127819
|
|
|
@@ -127797,7 +127821,7 @@ Defined in: [lib/text.ts:353](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
127797
127821
|
|
|
127798
127822
|
> **sld**: `string` \| `null`
|
|
127799
127823
|
|
|
127800
|
-
Defined in: [lib/text.ts:
|
|
127824
|
+
Defined in: [lib/text.ts:353](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L353)
|
|
127801
127825
|
|
|
127802
127826
|
***
|
|
127803
127827
|
|
|
@@ -127805,7 +127829,7 @@ Defined in: [lib/text.ts:352](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
127805
127829
|
|
|
127806
127830
|
> **sub**: `string` \| `null`
|
|
127807
127831
|
|
|
127808
|
-
Defined in: [lib/text.ts:
|
|
127832
|
+
Defined in: [lib/text.ts:355](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L355)
|
|
127809
127833
|
|
|
127810
127834
|
***
|
|
127811
127835
|
|
|
@@ -127813,7 +127837,7 @@ Defined in: [lib/text.ts:354](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
127813
127837
|
|
|
127814
127838
|
> **tld**: `string` \| `null`
|
|
127815
127839
|
|
|
127816
|
-
Defined in: [lib/text.ts:
|
|
127840
|
+
Defined in: [lib/text.ts:352](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L352)
|
|
127817
127841
|
|
|
127818
127842
|
lib/text/type-aliases/TFalsy.md
|
|
127819
127843
|
---
|
|
@@ -127828,7 +127852,7 @@ lib/text/type-aliases/TFalsy.md
|
|
|
127828
127852
|
|
|
127829
127853
|
> **TFalsy** = `false` \| `""` \| `0` \| `null` \| `undefined` \| *typeof* `NaN`
|
|
127830
127854
|
|
|
127831
|
-
Defined in: [lib/text.ts:
|
|
127855
|
+
Defined in: [lib/text.ts:785](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L785)
|
|
127832
127856
|
|
|
127833
127857
|
虚假值类型
|
|
127834
127858
|
|
|
@@ -127845,7 +127869,7 @@ lib/text/variables/REGEXP_ASCII.md
|
|
|
127845
127869
|
|
|
127846
127870
|
> `const` **REGEXP\_ASCII**: `RegExp`
|
|
127847
127871
|
|
|
127848
|
-
Defined in: [lib/text.ts:
|
|
127872
|
+
Defined in: [lib/text.ts:324](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L324)
|
|
127849
127873
|
|
|
127850
127874
|
可打印的 ascii 字符集
|
|
127851
127875
|
|
|
@@ -127862,7 +127886,7 @@ lib/text/variables/REGEXP_DOMAIN.md
|
|
|
127862
127886
|
|
|
127863
127887
|
> `const` **REGEXP\_DOMAIN**: `RegExp`
|
|
127864
127888
|
|
|
127865
|
-
Defined in: [lib/text.ts:
|
|
127889
|
+
Defined in: [lib/text.ts:312](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L312)
|
|
127866
127890
|
|
|
127867
127891
|
lib/text/variables/REGEXP_EMAIL.md
|
|
127868
127892
|
---
|
|
@@ -127877,7 +127901,7 @@ lib/text/variables/REGEXP_EMAIL.md
|
|
|
127877
127901
|
|
|
127878
127902
|
> `const` **REGEXP\_EMAIL**: `RegExp`
|
|
127879
127903
|
|
|
127880
|
-
Defined in: [lib/text.ts:
|
|
127904
|
+
Defined in: [lib/text.ts:286](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L286)
|
|
127881
127905
|
|
|
127882
127906
|
lib/time/classes/Time.md
|
|
127883
127907
|
---
|
|
@@ -138093,7 +138117,7 @@ sys/route/functions/clearKebabConfigs.md
|
|
|
138093
138117
|
|
|
138094
138118
|
Defined in: [sys/route.ts:29](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L29)
|
|
138095
138119
|
|
|
138096
|
-
|
|
138120
|
+
清空缓存的项目配置,下次请求时重新读取文件
|
|
138097
138121
|
|
|
138098
138122
|
## Returns
|
|
138099
138123
|
|
|
@@ -138112,7 +138136,7 @@ sys/route/functions/getFormData.md
|
|
|
138112
138136
|
|
|
138113
138137
|
> **getFormData**(`req`, `events?`, `limits?`): `Promise`\<`false` \| \{ `files`: `Record`\<`string`, [`IPostFile`](../../../index/interfaces/IPostFile.md) \| [`IPostFile`](../../../index/interfaces/IPostFile.md)[]\>; `post`: `Record`\<`string`, [`Json`](../../../index/type-aliases/Json.md)\>; \}\>
|
|
138114
138138
|
|
|
138115
|
-
Defined in: [sys/route.ts:
|
|
138139
|
+
Defined in: [sys/route.ts:1092](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1092)
|
|
138116
138140
|
|
|
138117
138141
|
获取 formdata 的 post
|
|
138118
138142
|
|
|
@@ -138155,7 +138179,7 @@ sys/route/functions/getPost.md
|
|
|
138155
138179
|
|
|
138156
138180
|
> **getPost**(`req`): `Promise`\<`false` \| \{ `input`: `string`; `post`: `Record`\<`string`, `any`\>; `raw`: `Record`\<`string`, `any`\>; \}\>
|
|
138157
138181
|
|
|
138158
|
-
Defined in: [sys/route.ts:
|
|
138182
|
+
Defined in: [sys/route.ts:927](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L927)
|
|
138159
138183
|
|
|
138160
138184
|
获取 post 对象(通常已自动获取),如果是文件上传(formdata)的情况则不获取
|
|
138161
138185
|
|
|
@@ -138273,7 +138297,7 @@ sys/route/functions/unlinkUploadFiles.md
|
|
|
138273
138297
|
|
|
138274
138298
|
> **unlinkUploadFiles**(`cctr`): `Promise`\<`void`\>
|
|
138275
138299
|
|
|
138276
|
-
Defined in: [sys/route.ts:
|
|
138300
|
+
Defined in: [sys/route.ts:885](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L885)
|
|
138277
138301
|
|
|
138278
138302
|
删除本次请求所有已上传的临时文件
|
|
138279
138303
|
|
|
@@ -138302,7 +138326,7 @@ sys/route/functions/waitCtr.md
|
|
|
138302
138326
|
|
|
138303
138327
|
> **waitCtr**(`cctr`): `Promise`\<`void`\>
|
|
138304
138328
|
|
|
138305
|
-
Defined in: [sys/route.ts:
|
|
138329
|
+
Defined in: [sys/route.ts:905](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L905)
|
|
138306
138330
|
|
|
138307
138331
|
等待异步任务结束,并删除临时文件,如果结束后还有事务没关闭,则会在本函数中打印控制台并且写入 log 文件
|
|
138308
138332
|
此时其实已经给客户端返回了,此处等待不消耗客户端的等待时间
|
|
@@ -138356,9 +138380,9 @@ sys/route/interfaces/IFormDataError.md
|
|
|
138356
138380
|
|
|
138357
138381
|
# Interface: IFormDataError
|
|
138358
138382
|
|
|
138359
|
-
Defined in: [sys/route.ts:
|
|
138383
|
+
Defined in: [sys/route.ts:1047](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1047)
|
|
138360
138384
|
|
|
138361
|
-
|
|
138385
|
+
解析上传数据时的失败原因,只提供错误码和限制值,不带临时路径或异常对象
|
|
138362
138386
|
|
|
138363
138387
|
## Properties
|
|
138364
138388
|
|
|
@@ -138366,7 +138390,7 @@ multipart 解析首次失败的安全诊断,不包含临时路径或异常对
|
|
|
138366
138390
|
|
|
138367
138391
|
> **code**: `"INVALID_BOUNDARY"` \| `"FILE_TOO_LARGE"` \| `"TOTAL_TOO_LARGE"` \| `"FIELD_TOO_LARGE"` \| `"HEADER_TOO_LARGE"` \| `"TOO_MANY_PARTS"` \| `"FILE_TYPE"` \| `"TIMEOUT"` \| `"TEMP_FILE_ERROR"` \| `"REQUEST_ERROR"` \| `"REQUEST_ABORTED"`
|
|
138368
138392
|
|
|
138369
|
-
Defined in: [sys/route.ts:
|
|
138393
|
+
Defined in: [sys/route.ts:1048](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1048)
|
|
138370
138394
|
|
|
138371
138395
|
***
|
|
138372
138396
|
|
|
@@ -138374,9 +138398,9 @@ Defined in: [sys/route.ts:1035](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138374
138398
|
|
|
138375
138399
|
> `optional` **limit?**: `number`
|
|
138376
138400
|
|
|
138377
|
-
Defined in: [sys/route.ts:
|
|
138401
|
+
Defined in: [sys/route.ts:1052](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1052)
|
|
138378
138402
|
|
|
138379
|
-
|
|
138403
|
+
超出的限制值:大小用字节,超时用毫秒,字段和文件数量用个
|
|
138380
138404
|
|
|
138381
138405
|
sys/route/interfaces/IFormDataEvents.md
|
|
138382
138406
|
---
|
|
@@ -138389,7 +138413,7 @@ sys/route/interfaces/IFormDataEvents.md
|
|
|
138389
138413
|
|
|
138390
138414
|
# Interface: IFormDataEvents
|
|
138391
138415
|
|
|
138392
|
-
Defined in: [sys/route.ts:
|
|
138416
|
+
Defined in: [sys/route.ts:1056](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1056)
|
|
138393
138417
|
|
|
138394
138418
|
multipart 文件处理及失败通知
|
|
138395
138419
|
|
|
@@ -138399,9 +138423,9 @@ multipart 文件处理及失败通知
|
|
|
138399
138423
|
|
|
138400
138424
|
> `optional` **onerror?**: (`error`) => `void`
|
|
138401
138425
|
|
|
138402
|
-
Defined in: [sys/route.ts:
|
|
138426
|
+
Defined in: [sys/route.ts:1064](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1064)
|
|
138403
138427
|
|
|
138404
|
-
|
|
138428
|
+
首次失败时调用一次,getFormData 返回 false;若连接已断开,可能无法回复客户端
|
|
138405
138429
|
|
|
138406
138430
|
#### Parameters
|
|
138407
138431
|
|
|
@@ -138419,7 +138443,7 @@ Defined in: [sys/route.ts:1051](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138419
138443
|
|
|
138420
138444
|
> `optional` **onfiledata?**: (`chunk`) => `void`
|
|
138421
138445
|
|
|
138422
|
-
Defined in: [sys/route.ts:
|
|
138446
|
+
Defined in: [sys/route.ts:1060](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1060)
|
|
138423
138447
|
|
|
138424
138448
|
文件上传时触发,仅 start 返回 true 时触发
|
|
138425
138449
|
|
|
@@ -138439,7 +138463,7 @@ Defined in: [sys/route.ts:1047](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138439
138463
|
|
|
138440
138464
|
> `optional` **onfileend?**: () => `void`
|
|
138441
138465
|
|
|
138442
|
-
Defined in: [sys/route.ts:
|
|
138466
|
+
Defined in: [sys/route.ts:1062](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1062)
|
|
138443
138467
|
|
|
138444
138468
|
文件上传结束时触发,仅 start 返回 true 时触发
|
|
138445
138469
|
|
|
@@ -138453,7 +138477,7 @@ Defined in: [sys/route.ts:1049](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138453
138477
|
|
|
138454
138478
|
> `optional` **onfilestart?**: (`name`) => `boolean` \| `undefined`
|
|
138455
138479
|
|
|
138456
|
-
Defined in: [sys/route.ts:
|
|
138480
|
+
Defined in: [sys/route.ts:1058](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1058)
|
|
138457
138481
|
|
|
138458
138482
|
文件开始上传时触发,返回 true 则跳过该文件的保存
|
|
138459
138483
|
|
|
@@ -138478,7 +138502,7 @@ sys/route/interfaces/IFormDataLimits.md
|
|
|
138478
138502
|
|
|
138479
138503
|
# Interface: IFormDataLimits
|
|
138480
138504
|
|
|
138481
|
-
Defined in: [sys/route.ts:
|
|
138505
|
+
Defined in: [sys/route.ts:1068](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1068)
|
|
138482
138506
|
|
|
138483
138507
|
multipart 上传限制
|
|
138484
138508
|
|
|
@@ -138488,7 +138512,7 @@ multipart 上传限制
|
|
|
138488
138512
|
|
|
138489
138513
|
> `optional` **allowedExts?**: `string`[]
|
|
138490
138514
|
|
|
138491
|
-
Defined in: [sys/route.ts:
|
|
138515
|
+
Defined in: [sys/route.ts:1072](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1072)
|
|
138492
138516
|
|
|
138493
138517
|
允许的文件扩展名(含点号),如 ['.jpg', '.png', '.pdf']
|
|
138494
138518
|
|
|
@@ -138498,7 +138522,7 @@ Defined in: [sys/route.ts:1059](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138498
138522
|
|
|
138499
138523
|
> `optional` **maxFieldSize?**: `number`
|
|
138500
138524
|
|
|
138501
|
-
Defined in: [sys/route.ts:
|
|
138525
|
+
Defined in: [sys/route.ts:1074](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1074)
|
|
138502
138526
|
|
|
138503
138527
|
单个字段(非文件)最大字节数,默认 1 MB
|
|
138504
138528
|
|
|
@@ -138508,7 +138532,7 @@ Defined in: [sys/route.ts:1061](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138508
138532
|
|
|
138509
138533
|
> `optional` **maxFileSize?**: `number`
|
|
138510
138534
|
|
|
138511
|
-
Defined in: [sys/route.ts:
|
|
138535
|
+
Defined in: [sys/route.ts:1070](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1070)
|
|
138512
138536
|
|
|
138513
138537
|
单个文件最大字节数
|
|
138514
138538
|
|
|
@@ -138518,9 +138542,9 @@ Defined in: [sys/route.ts:1057](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138518
138542
|
|
|
138519
138543
|
> `optional` **maxHeaderSize?**: `number`
|
|
138520
138544
|
|
|
138521
|
-
Defined in: [sys/route.ts:
|
|
138545
|
+
Defined in: [sys/route.ts:1078](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1078)
|
|
138522
138546
|
|
|
138523
|
-
|
|
138547
|
+
每个字段或文件的 multipart 头部最多多少字节,默认 16 KB
|
|
138524
138548
|
|
|
138525
138549
|
***
|
|
138526
138550
|
|
|
@@ -138528,7 +138552,7 @@ Defined in: [sys/route.ts:1065](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138528
138552
|
|
|
138529
138553
|
> `optional` **maxParts?**: `number`
|
|
138530
138554
|
|
|
138531
|
-
Defined in: [sys/route.ts:
|
|
138555
|
+
Defined in: [sys/route.ts:1080](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1080)
|
|
138532
138556
|
|
|
138533
138557
|
multipart 字段与文件总数量,默认 1000
|
|
138534
138558
|
|
|
@@ -138538,7 +138562,7 @@ multipart 字段与文件总数量,默认 1000
|
|
|
138538
138562
|
|
|
138539
138563
|
> `optional` **maxTotalSize?**: `number`
|
|
138540
138564
|
|
|
138541
|
-
Defined in: [sys/route.ts:
|
|
138565
|
+
Defined in: [sys/route.ts:1076](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1076)
|
|
138542
138566
|
|
|
138543
138567
|
整体请求最大字节数,不设置或设为 0 则不限制
|
|
138544
138568
|
|
|
@@ -138548,6 +138572,6 @@ Defined in: [sys/route.ts:1063](https://github.com/maiyunnet/kebab/blob/master/s
|
|
|
138548
138572
|
|
|
138549
138573
|
> `optional` **timeout?**: `number`
|
|
138550
138574
|
|
|
138551
|
-
Defined in: [sys/route.ts:
|
|
138575
|
+
Defined in: [sys/route.ts:1082](https://github.com/maiyunnet/kebab/blob/master/sys/route.ts#L1082)
|
|
138552
138576
|
|
|
138553
138577
|
整体请求超时时间(毫秒),默认 5 分钟,设为 0 禁用超时
|