@maiyunnet/kebab 9.22.4 → 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 +127 -103
- package/index.d.ts +7 -2
- package/index.js +1 -1
- package/lib/text.d.ts +6 -4
- package/lib/text.js +11 -34
- package/package.json +3 -2
- package/sys/master.js +185 -279
- 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
|
|
|
@@ -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 禁用超时
|