@maiyunnet/kebab 7.6.3 → 7.7.0
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/doc/kebab-rag.md +236 -157
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/fs.js +0 -5
- package/lib/net.d.ts +9 -9
- package/lib/net.js +19 -19
- package/lib/s3.d.ts +1 -0
- package/lib/text.d.ts +9 -0
- package/lib/text.js +27 -11
- package/lib/ws.js +13 -5
- package/package.json +1 -1
- package/sys/child.js +6 -1
- package/sys/ctr.d.ts +11 -2
- package/sys/ctr.js +8 -1
- package/sys/route.js +2 -2
- package/www/example/ctr/test.js +9 -4
package/doc/kebab-rag.md
CHANGED
|
@@ -1385,7 +1385,7 @@ index/variables/VER.md
|
|
|
1385
1385
|
|
|
1386
1386
|
# Variable: VER
|
|
1387
1387
|
|
|
1388
|
-
> `const` **VER**: `"7.
|
|
1388
|
+
> `const` **VER**: `"7.7.0"` = `'7.7.0'`
|
|
1389
1389
|
|
|
1390
1390
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1391
1391
|
|
|
@@ -10105,7 +10105,7 @@ lib/net/functions/buildCookieQuery.md
|
|
|
10105
10105
|
|
|
10106
10106
|
> **buildCookieQuery**(`cookie`, `uri`): `string`
|
|
10107
10107
|
|
|
10108
|
-
Defined in: [lib/net.ts:
|
|
10108
|
+
Defined in: [lib/net.ts:474](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L474)
|
|
10109
10109
|
|
|
10110
10110
|
对象转换为 Cookie 拼接字符串(会自动筛掉不能发送的 cookie)
|
|
10111
10111
|
|
|
@@ -10140,7 +10140,7 @@ lib/net/functions/fetch.md
|
|
|
10140
10140
|
|
|
10141
10141
|
> **fetch**(`input`, `init`): `Promise`\<`Response`\>
|
|
10142
10142
|
|
|
10143
|
-
Defined in: [lib/net.ts:
|
|
10143
|
+
Defined in: [lib/net.ts:131](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L131)
|
|
10144
10144
|
|
|
10145
10145
|
发起一个原生 fetch 请求,增加了一些框架选项,注意:会抛出错误
|
|
10146
10146
|
|
|
@@ -10175,7 +10175,7 @@ lib/net/functions/filterHeaders.md
|
|
|
10175
10175
|
|
|
10176
10176
|
> **filterHeaders**(`headers`, `res?`, `filter?`): `Record`\<`string`, `string` \| `string`[]\>
|
|
10177
10177
|
|
|
10178
|
-
Defined in: [lib/net.ts:
|
|
10178
|
+
Defined in: [lib/net.ts:552](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L552)
|
|
10179
10179
|
|
|
10180
10180
|
剔除不代理的 header,返回新的 header
|
|
10181
10181
|
|
|
@@ -10216,7 +10216,7 @@ lib/net/functions/get.md
|
|
|
10216
10216
|
|
|
10217
10217
|
> **get**(`u`, `opt`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
10218
10218
|
|
|
10219
|
-
Defined in: [lib/net.ts:
|
|
10219
|
+
Defined in: [lib/net.ts:67](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L67)
|
|
10220
10220
|
|
|
10221
10221
|
发起一个 get 请求
|
|
10222
10222
|
|
|
@@ -10272,7 +10272,7 @@ lib/net/functions/getFormData.md
|
|
|
10272
10272
|
|
|
10273
10273
|
> **getFormData**(): [`FormData`](../formdata/classes/FormData.md)
|
|
10274
10274
|
|
|
10275
|
-
Defined in: [lib/net.ts:
|
|
10275
|
+
Defined in: [lib/net.ts:536](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L536)
|
|
10276
10276
|
|
|
10277
10277
|
创建 FormData 对象
|
|
10278
10278
|
|
|
@@ -10293,7 +10293,7 @@ lib/net/functions/mproxy.md
|
|
|
10293
10293
|
|
|
10294
10294
|
> **mproxy**(`ctr`, `auth`, `opt`): `Promise`\<`number`\>
|
|
10295
10295
|
|
|
10296
|
-
Defined in: [lib/net.ts:
|
|
10296
|
+
Defined in: [lib/net.ts:588](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L588)
|
|
10297
10297
|
|
|
10298
10298
|
正向 mproxy 代理,注意提前处理不要自动处理 post 数据,读取 get 的 url 为实际请求地址
|
|
10299
10299
|
get: url, auth
|
|
@@ -10335,7 +10335,7 @@ lib/net/functions/mproxyData.md
|
|
|
10335
10335
|
|
|
10336
10336
|
> **mproxyData**(`ctr`): `any`
|
|
10337
10337
|
|
|
10338
|
-
Defined in: [lib/net.ts:
|
|
10338
|
+
Defined in: [lib/net.ts:637](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L637)
|
|
10339
10339
|
|
|
10340
10340
|
获取 mproxy 的附加数据
|
|
10341
10341
|
|
|
@@ -10364,7 +10364,7 @@ lib/net/functions/open.md
|
|
|
10364
10364
|
|
|
10365
10365
|
> **open**(`u`): [`Request`](../request/classes/Request.md)
|
|
10366
10366
|
|
|
10367
|
-
Defined in: [lib/net.ts:
|
|
10367
|
+
Defined in: [lib/net.ts:58](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L58)
|
|
10368
10368
|
|
|
10369
10369
|
创建一个请求对象
|
|
10370
10370
|
|
|
@@ -10391,7 +10391,7 @@ lib/net/functions/post.md
|
|
|
10391
10391
|
|
|
10392
10392
|
> **post**(`u`, `data`, `opt`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
10393
10393
|
|
|
10394
|
-
Defined in: [lib/net.ts:
|
|
10394
|
+
Defined in: [lib/net.ts:77](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L77)
|
|
10395
10395
|
|
|
10396
10396
|
发起一个 post 请求
|
|
10397
10397
|
|
|
@@ -10432,7 +10432,7 @@ lib/net/functions/postJson.md
|
|
|
10432
10432
|
|
|
10433
10433
|
> **postJson**(`u`, `data`, `opt`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
10434
10434
|
|
|
10435
|
-
Defined in: [lib/net.ts:
|
|
10435
|
+
Defined in: [lib/net.ts:92](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L92)
|
|
10436
10436
|
|
|
10437
10437
|
发起 JSON 请求
|
|
10438
10438
|
|
|
@@ -10473,7 +10473,7 @@ lib/net/functions/postJsonResponseJson.md
|
|
|
10473
10473
|
|
|
10474
10474
|
> **postJsonResponseJson**(`u`, `data`, `opt`): `Promise`\<`any`\>
|
|
10475
10475
|
|
|
10476
|
-
Defined in: [lib/net.ts:
|
|
10476
|
+
Defined in: [lib/net.ts:109](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L109)
|
|
10477
10477
|
|
|
10478
10478
|
发起 JSON 请求并解析 JSON 响应
|
|
10479
10479
|
|
|
@@ -10516,7 +10516,7 @@ lib/net/functions/request.md
|
|
|
10516
10516
|
|
|
10517
10517
|
> **request**(`u`, `data?`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
10518
10518
|
|
|
10519
|
-
Defined in: [lib/net.ts:
|
|
10519
|
+
Defined in: [lib/net.ts:160](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L160)
|
|
10520
10520
|
|
|
10521
10521
|
发起一个请求
|
|
10522
10522
|
|
|
@@ -10553,7 +10553,7 @@ lib/net/functions/resetCookieSession.md
|
|
|
10553
10553
|
|
|
10554
10554
|
> **resetCookieSession**(`cookie`): `void`
|
|
10555
10555
|
|
|
10556
|
-
Defined in: [lib/net.ts:
|
|
10556
|
+
Defined in: [lib/net.ts:524](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L524)
|
|
10557
10557
|
|
|
10558
10558
|
模拟重启浏览器后的状态
|
|
10559
10559
|
|
|
@@ -10582,7 +10582,7 @@ lib/net/functions/rproxy.md
|
|
|
10582
10582
|
|
|
10583
10583
|
> **rproxy**(`ctr`, `route`, `opt`): `Promise`\<`boolean`\>
|
|
10584
10584
|
|
|
10585
|
-
Defined in: [lib/net.ts:
|
|
10585
|
+
Defined in: [lib/net.ts:655](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L655)
|
|
10586
10586
|
|
|
10587
10587
|
反向代理,注意提前处理不要自动处理 post 数据,将本服务器的某个路由反代到其他网址
|
|
10588
10588
|
|
|
@@ -10623,7 +10623,7 @@ lib/net/functions/setCookie.md
|
|
|
10623
10623
|
|
|
10624
10624
|
> **setCookie**(`cookie`, `name`, `value`, `domain`, `opt`): `void`
|
|
10625
10625
|
|
|
10626
|
-
Defined in: [lib/net.ts:
|
|
10626
|
+
Defined in: [lib/net.ts:336](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L336)
|
|
10627
10627
|
|
|
10628
10628
|
对 cookie 对象进行操作
|
|
10629
10629
|
|
|
@@ -10729,7 +10729,7 @@ lib/net/interfaces/ICookie.md
|
|
|
10729
10729
|
|
|
10730
10730
|
# Interface: ICookie
|
|
10731
10731
|
|
|
10732
|
-
Defined in: [lib/net.ts:
|
|
10732
|
+
Defined in: [lib/net.ts:780](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L780)
|
|
10733
10733
|
|
|
10734
10734
|
Net Cookie 对象
|
|
10735
10735
|
|
|
@@ -10739,7 +10739,7 @@ Net Cookie 对象
|
|
|
10739
10739
|
|
|
10740
10740
|
> **domain**: `string`
|
|
10741
10741
|
|
|
10742
|
-
Defined in: [lib/net.ts:
|
|
10742
|
+
Defined in: [lib/net.ts:786](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L786)
|
|
10743
10743
|
|
|
10744
10744
|
***
|
|
10745
10745
|
|
|
@@ -10747,7 +10747,7 @@ Defined in: [lib/net.ts:781](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10747
10747
|
|
|
10748
10748
|
> **exp**: `number`
|
|
10749
10749
|
|
|
10750
|
-
Defined in: [lib/net.ts:
|
|
10750
|
+
Defined in: [lib/net.ts:784](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L784)
|
|
10751
10751
|
|
|
10752
10752
|
有效期秒级时间戳
|
|
10753
10753
|
|
|
@@ -10757,7 +10757,7 @@ Defined in: [lib/net.ts:779](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10757
10757
|
|
|
10758
10758
|
> **httponly**: `boolean`
|
|
10759
10759
|
|
|
10760
|
-
Defined in: [lib/net.ts:
|
|
10760
|
+
Defined in: [lib/net.ts:788](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L788)
|
|
10761
10761
|
|
|
10762
10762
|
***
|
|
10763
10763
|
|
|
@@ -10765,7 +10765,7 @@ Defined in: [lib/net.ts:783](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10765
10765
|
|
|
10766
10766
|
> **name**: `string`
|
|
10767
10767
|
|
|
10768
|
-
Defined in: [lib/net.ts:
|
|
10768
|
+
Defined in: [lib/net.ts:781](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L781)
|
|
10769
10769
|
|
|
10770
10770
|
***
|
|
10771
10771
|
|
|
@@ -10773,7 +10773,7 @@ Defined in: [lib/net.ts:776](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10773
10773
|
|
|
10774
10774
|
> **path**: `string`
|
|
10775
10775
|
|
|
10776
|
-
Defined in: [lib/net.ts:
|
|
10776
|
+
Defined in: [lib/net.ts:785](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L785)
|
|
10777
10777
|
|
|
10778
10778
|
***
|
|
10779
10779
|
|
|
@@ -10781,7 +10781,7 @@ Defined in: [lib/net.ts:780](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10781
10781
|
|
|
10782
10782
|
> **secure**: `boolean`
|
|
10783
10783
|
|
|
10784
|
-
Defined in: [lib/net.ts:
|
|
10784
|
+
Defined in: [lib/net.ts:787](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L787)
|
|
10785
10785
|
|
|
10786
10786
|
***
|
|
10787
10787
|
|
|
@@ -10789,7 +10789,7 @@ Defined in: [lib/net.ts:782](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10789
10789
|
|
|
10790
10790
|
> **value**: `string`
|
|
10791
10791
|
|
|
10792
|
-
Defined in: [lib/net.ts:
|
|
10792
|
+
Defined in: [lib/net.ts:782](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L782)
|
|
10793
10793
|
|
|
10794
10794
|
lib/net/interfaces/IMproxyOptions.md
|
|
10795
10795
|
---
|
|
@@ -10802,7 +10802,7 @@ lib/net/interfaces/IMproxyOptions.md
|
|
|
10802
10802
|
|
|
10803
10803
|
# Interface: IMproxyOptions
|
|
10804
10804
|
|
|
10805
|
-
Defined in: [lib/net.ts:
|
|
10805
|
+
Defined in: [lib/net.ts:735](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L735)
|
|
10806
10806
|
|
|
10807
10807
|
正向代理请求的传入参数选项
|
|
10808
10808
|
|
|
@@ -10812,7 +10812,7 @@ Defined in: [lib/net.ts:730](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10812
10812
|
|
|
10813
10813
|
> `optional` **filter**: (`h`) => `boolean`
|
|
10814
10814
|
|
|
10815
|
-
Defined in: [lib/net.ts:
|
|
10815
|
+
Defined in: [lib/net.ts:744](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L744)
|
|
10816
10816
|
|
|
10817
10817
|
过滤 header,返回 true 则留下
|
|
10818
10818
|
|
|
@@ -10832,7 +10832,7 @@ Defined in: [lib/net.ts:739](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10832
10832
|
|
|
10833
10833
|
> `optional` **follow**: `number`
|
|
10834
10834
|
|
|
10835
|
-
Defined in: [lib/net.ts:
|
|
10835
|
+
Defined in: [lib/net.ts:738](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L738)
|
|
10836
10836
|
|
|
10837
10837
|
***
|
|
10838
10838
|
|
|
@@ -10840,7 +10840,7 @@ Defined in: [lib/net.ts:733](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10840
10840
|
|
|
10841
10841
|
> `optional` **headers**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
10842
10842
|
|
|
10843
|
-
Defined in: [lib/net.ts:
|
|
10843
|
+
Defined in: [lib/net.ts:742](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L742)
|
|
10844
10844
|
|
|
10845
10845
|
***
|
|
10846
10846
|
|
|
@@ -10848,7 +10848,7 @@ Defined in: [lib/net.ts:737](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10848
10848
|
|
|
10849
10849
|
> `optional` **hosts**: `string` \| `Record`\<`string`, `string`\>
|
|
10850
10850
|
|
|
10851
|
-
Defined in: [lib/net.ts:
|
|
10851
|
+
Defined in: [lib/net.ts:740](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L740)
|
|
10852
10852
|
|
|
10853
10853
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
10854
10854
|
|
|
@@ -10858,7 +10858,7 @@ Defined in: [lib/net.ts:735](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10858
10858
|
|
|
10859
10859
|
> `optional` **local**: `string`
|
|
10860
10860
|
|
|
10861
|
-
Defined in: [lib/net.ts:
|
|
10861
|
+
Defined in: [lib/net.ts:741](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L741)
|
|
10862
10862
|
|
|
10863
10863
|
***
|
|
10864
10864
|
|
|
@@ -10866,7 +10866,7 @@ Defined in: [lib/net.ts:736](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10866
10866
|
|
|
10867
10867
|
> `optional` **reuse**: `string`
|
|
10868
10868
|
|
|
10869
|
-
Defined in: [lib/net.ts:
|
|
10869
|
+
Defined in: [lib/net.ts:746](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L746)
|
|
10870
10870
|
|
|
10871
10871
|
默认为 default
|
|
10872
10872
|
|
|
@@ -10876,7 +10876,7 @@ Defined in: [lib/net.ts:741](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10876
10876
|
|
|
10877
10877
|
> `optional` **timeout**: `number`
|
|
10878
10878
|
|
|
10879
|
-
Defined in: [lib/net.ts:
|
|
10879
|
+
Defined in: [lib/net.ts:737](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L737)
|
|
10880
10880
|
|
|
10881
10881
|
秒数
|
|
10882
10882
|
|
|
@@ -10891,7 +10891,7 @@ lib/net/interfaces/IRequestOptions.md
|
|
|
10891
10891
|
|
|
10892
10892
|
# Interface: IRequestOptions
|
|
10893
10893
|
|
|
10894
|
-
Defined in: [lib/net.ts:
|
|
10894
|
+
Defined in: [lib/net.ts:708](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L708)
|
|
10895
10895
|
|
|
10896
10896
|
请求的传入参数选项
|
|
10897
10897
|
|
|
@@ -10901,7 +10901,7 @@ Defined in: [lib/net.ts:703](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10901
10901
|
|
|
10902
10902
|
> `optional` **cookie**: `Record`\<`string`, [`ICookie`](ICookie.md)\>
|
|
10903
10903
|
|
|
10904
|
-
Defined in: [lib/net.ts:
|
|
10904
|
+
Defined in: [lib/net.ts:731](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L731)
|
|
10905
10905
|
|
|
10906
10906
|
cookie 托管对象
|
|
10907
10907
|
|
|
@@ -10911,7 +10911,7 @@ cookie 托管对象
|
|
|
10911
10911
|
|
|
10912
10912
|
> `optional` **follow**: `number`
|
|
10913
10913
|
|
|
10914
|
-
Defined in: [lib/net.ts:
|
|
10914
|
+
Defined in: [lib/net.ts:714](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L714)
|
|
10915
10915
|
|
|
10916
10916
|
追踪 location 次数,0 为不追踪,默认为 0
|
|
10917
10917
|
|
|
@@ -10921,7 +10921,7 @@ Defined in: [lib/net.ts:709](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10921
10921
|
|
|
10922
10922
|
> `optional` **headers**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
10923
10923
|
|
|
10924
|
-
Defined in: [lib/net.ts:
|
|
10924
|
+
Defined in: [lib/net.ts:719](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L719)
|
|
10925
10925
|
|
|
10926
10926
|
***
|
|
10927
10927
|
|
|
@@ -10929,7 +10929,7 @@ Defined in: [lib/net.ts:714](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10929
10929
|
|
|
10930
10930
|
> `optional` **hosts**: `string` \| `Record`\<`string`, `string`\>
|
|
10931
10931
|
|
|
10932
|
-
Defined in: [lib/net.ts:
|
|
10932
|
+
Defined in: [lib/net.ts:716](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L716)
|
|
10933
10933
|
|
|
10934
10934
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
10935
10935
|
|
|
@@ -10939,7 +10939,7 @@ Defined in: [lib/net.ts:711](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10939
10939
|
|
|
10940
10940
|
> `optional` **keep**: `boolean`
|
|
10941
10941
|
|
|
10942
|
-
Defined in: [lib/net.ts:
|
|
10942
|
+
Defined in: [lib/net.ts:727](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L727)
|
|
10943
10943
|
|
|
10944
10944
|
连接是否保持长连接(即是否允许复用),默认为 true
|
|
10945
10945
|
|
|
@@ -10949,7 +10949,7 @@ Defined in: [lib/net.ts:722](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10949
10949
|
|
|
10950
10950
|
> `optional` **local**: `string`
|
|
10951
10951
|
|
|
10952
|
-
Defined in: [lib/net.ts:
|
|
10952
|
+
Defined in: [lib/net.ts:718](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L718)
|
|
10953
10953
|
|
|
10954
10954
|
***
|
|
10955
10955
|
|
|
@@ -10957,7 +10957,7 @@ Defined in: [lib/net.ts:713](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10957
10957
|
|
|
10958
10958
|
> `optional` **method**: `"GET"` \| `"POST"` \| `"PUT"` \| `"DELETE"` \| `"OPTIONS"`
|
|
10959
10959
|
|
|
10960
|
-
Defined in: [lib/net.ts:
|
|
10960
|
+
Defined in: [lib/net.ts:709](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L709)
|
|
10961
10961
|
|
|
10962
10962
|
***
|
|
10963
10963
|
|
|
@@ -10965,7 +10965,7 @@ Defined in: [lib/net.ts:704](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10965
10965
|
|
|
10966
10966
|
> `optional` **mproxy**: `object`
|
|
10967
10967
|
|
|
10968
|
-
Defined in: [lib/net.ts:
|
|
10968
|
+
Defined in: [lib/net.ts:721](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L721)
|
|
10969
10969
|
|
|
10970
10970
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
10971
10971
|
|
|
@@ -10987,7 +10987,7 @@ Defined in: [lib/net.ts:716](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10987
10987
|
|
|
10988
10988
|
> `optional` **reuse**: `string`
|
|
10989
10989
|
|
|
10990
|
-
Defined in: [lib/net.ts:
|
|
10990
|
+
Defined in: [lib/net.ts:729](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L729)
|
|
10991
10991
|
|
|
10992
10992
|
复用池名,默认为 default
|
|
10993
10993
|
|
|
@@ -10997,7 +10997,7 @@ Defined in: [lib/net.ts:724](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
10997
10997
|
|
|
10998
10998
|
> `optional` **save**: `string`
|
|
10999
10999
|
|
|
11000
|
-
Defined in: [lib/net.ts:
|
|
11000
|
+
Defined in: [lib/net.ts:717](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L717)
|
|
11001
11001
|
|
|
11002
11002
|
***
|
|
11003
11003
|
|
|
@@ -11005,7 +11005,7 @@ Defined in: [lib/net.ts:712](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11005
11005
|
|
|
11006
11006
|
> `optional` **timeout**: `number`
|
|
11007
11007
|
|
|
11008
|
-
Defined in: [lib/net.ts:
|
|
11008
|
+
Defined in: [lib/net.ts:712](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L712)
|
|
11009
11009
|
|
|
11010
11010
|
秒数
|
|
11011
11011
|
|
|
@@ -11015,7 +11015,7 @@ Defined in: [lib/net.ts:707](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11015
11015
|
|
|
11016
11016
|
> `optional` **type**: `"form"` \| `"json"`
|
|
11017
11017
|
|
|
11018
|
-
Defined in: [lib/net.ts:
|
|
11018
|
+
Defined in: [lib/net.ts:710](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L710)
|
|
11019
11019
|
|
|
11020
11020
|
lib/net/interfaces/IRproxyOptions.md
|
|
11021
11021
|
---
|
|
@@ -11028,7 +11028,7 @@ lib/net/interfaces/IRproxyOptions.md
|
|
|
11028
11028
|
|
|
11029
11029
|
# Interface: IRproxyOptions
|
|
11030
11030
|
|
|
11031
|
-
Defined in: [lib/net.ts:
|
|
11031
|
+
Defined in: [lib/net.ts:750](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L750)
|
|
11032
11032
|
|
|
11033
11033
|
反向代理请求的传入参数选项
|
|
11034
11034
|
|
|
@@ -11038,7 +11038,7 @@ Defined in: [lib/net.ts:745](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11038
11038
|
|
|
11039
11039
|
> `optional` **filter**: (`h`) => `boolean`
|
|
11040
11040
|
|
|
11041
|
-
Defined in: [lib/net.ts:
|
|
11041
|
+
Defined in: [lib/net.ts:759](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L759)
|
|
11042
11042
|
|
|
11043
11043
|
过滤 header,返回 true 则留下
|
|
11044
11044
|
|
|
@@ -11058,7 +11058,7 @@ Defined in: [lib/net.ts:754](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11058
11058
|
|
|
11059
11059
|
> `optional` **follow**: `number`
|
|
11060
11060
|
|
|
11061
|
-
Defined in: [lib/net.ts:
|
|
11061
|
+
Defined in: [lib/net.ts:753](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L753)
|
|
11062
11062
|
|
|
11063
11063
|
***
|
|
11064
11064
|
|
|
@@ -11066,7 +11066,7 @@ Defined in: [lib/net.ts:748](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11066
11066
|
|
|
11067
11067
|
> `optional` **headers**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
11068
11068
|
|
|
11069
|
-
Defined in: [lib/net.ts:
|
|
11069
|
+
Defined in: [lib/net.ts:757](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L757)
|
|
11070
11070
|
|
|
11071
11071
|
***
|
|
11072
11072
|
|
|
@@ -11074,7 +11074,7 @@ Defined in: [lib/net.ts:752](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11074
11074
|
|
|
11075
11075
|
> `optional` **hosts**: `string` \| `Record`\<`string`, `string`\>
|
|
11076
11076
|
|
|
11077
|
-
Defined in: [lib/net.ts:
|
|
11077
|
+
Defined in: [lib/net.ts:755](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L755)
|
|
11078
11078
|
|
|
11079
11079
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
11080
11080
|
|
|
@@ -11084,7 +11084,7 @@ Defined in: [lib/net.ts:750](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11084
11084
|
|
|
11085
11085
|
> `optional` **local**: `string`
|
|
11086
11086
|
|
|
11087
|
-
Defined in: [lib/net.ts:
|
|
11087
|
+
Defined in: [lib/net.ts:756](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L756)
|
|
11088
11088
|
|
|
11089
11089
|
***
|
|
11090
11090
|
|
|
@@ -11092,7 +11092,7 @@ Defined in: [lib/net.ts:751](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11092
11092
|
|
|
11093
11093
|
> `optional` **mproxy**: `object`
|
|
11094
11094
|
|
|
11095
|
-
Defined in: [lib/net.ts:
|
|
11095
|
+
Defined in: [lib/net.ts:761](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L761)
|
|
11096
11096
|
|
|
11097
11097
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
11098
11098
|
|
|
@@ -11114,7 +11114,7 @@ Defined in: [lib/net.ts:756](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11114
11114
|
|
|
11115
11115
|
> `optional` **reuse**: `string`
|
|
11116
11116
|
|
|
11117
|
-
Defined in: [lib/net.ts:
|
|
11117
|
+
Defined in: [lib/net.ts:767](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L767)
|
|
11118
11118
|
|
|
11119
11119
|
默认为 default
|
|
11120
11120
|
|
|
@@ -11124,7 +11124,7 @@ Defined in: [lib/net.ts:762](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
11124
11124
|
|
|
11125
11125
|
> `optional` **timeout**: `number`
|
|
11126
11126
|
|
|
11127
|
-
Defined in: [lib/net.ts:
|
|
11127
|
+
Defined in: [lib/net.ts:752](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L752)
|
|
11128
11128
|
|
|
11129
11129
|
秒数
|
|
11130
11130
|
|
|
@@ -11585,7 +11585,7 @@ lib/net/type-aliases/THttpHeaders.md
|
|
|
11585
11585
|
|
|
11586
11586
|
> **THttpHeaders** = `http.IncomingHttpHeaders` & `object`
|
|
11587
11587
|
|
|
11588
|
-
Defined in: [lib/net.ts:
|
|
11588
|
+
Defined in: [lib/net.ts:772](https://github.com/maiyunnet/kebab/blob/master/lib/net.ts#L772)
|
|
11589
11589
|
|
|
11590
11590
|
http headers
|
|
11591
11591
|
|
|
@@ -11644,7 +11644,7 @@ Defined in: [lib/s3.ts:52](https://github.com/maiyunnet/kebab/blob/master/lib/s3
|
|
|
11644
11644
|
|
|
11645
11645
|
> **deleteObject**(`key`, `bucket?`): `Promise`\<`boolean`\>
|
|
11646
11646
|
|
|
11647
|
-
Defined in: [lib/s3.ts:
|
|
11647
|
+
Defined in: [lib/s3.ts:169](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L169)
|
|
11648
11648
|
|
|
11649
11649
|
删除对象
|
|
11650
11650
|
|
|
@@ -11672,7 +11672,7 @@ bucket 名
|
|
|
11672
11672
|
|
|
11673
11673
|
> **deleteObjects**(`keys`, `bucket?`): `Promise`\<`boolean`\>
|
|
11674
11674
|
|
|
11675
|
-
Defined in: [lib/s3.ts:
|
|
11675
|
+
Defined in: [lib/s3.ts:189](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L189)
|
|
11676
11676
|
|
|
11677
11677
|
批量删除对象
|
|
11678
11678
|
|
|
@@ -11700,7 +11700,7 @@ bucket 名
|
|
|
11700
11700
|
|
|
11701
11701
|
> **destroy**(): `void`
|
|
11702
11702
|
|
|
11703
|
-
Defined in: [lib/s3.ts:
|
|
11703
|
+
Defined in: [lib/s3.ts:231](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L231)
|
|
11704
11704
|
|
|
11705
11705
|
销毁连接,释放资源
|
|
11706
11706
|
一般会自动垃圾回收,但高频接口也可主动调用
|
|
@@ -11715,7 +11715,7 @@ Defined in: [lib/s3.ts:230](https://github.com/maiyunnet/kebab/blob/master/lib/s
|
|
|
11715
11715
|
|
|
11716
11716
|
> **getObject**(`key`, `bucket?`): `Promise`\<`false` \| `Readable` & `SdkStreamMixin` \| `Blob` & `SdkStreamMixin` \| `ReadableStream`\<`any`\> & `SdkStreamMixin` \| `undefined`\>
|
|
11717
11717
|
|
|
11718
|
-
Defined in: [lib/s3.ts:
|
|
11718
|
+
Defined in: [lib/s3.ts:149](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L149)
|
|
11719
11719
|
|
|
11720
11720
|
获取对象流,可通过流获取 buffer 或 text
|
|
11721
11721
|
|
|
@@ -11743,7 +11743,7 @@ bucket 名
|
|
|
11743
11743
|
|
|
11744
11744
|
> **headObject**(`key`, `bucket?`): `Promise`\<`false` \| `HeadObjectCommandOutput`\>
|
|
11745
11745
|
|
|
11746
|
-
Defined in: [lib/s3.ts:
|
|
11746
|
+
Defined in: [lib/s3.ts:211](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L211)
|
|
11747
11747
|
|
|
11748
11748
|
检测对象是否存在
|
|
11749
11749
|
|
|
@@ -11793,7 +11793,29 @@ Defined in: [lib/s3.ts:103](https://github.com/maiyunnet/kebab/blob/master/lib/s
|
|
|
11793
11793
|
|
|
11794
11794
|
设置 contentLength,如果是流模式则需要设置此项,也可以设置为对象参数
|
|
11795
11795
|
|
|
11796
|
-
`number` |
|
|
11796
|
+
`number` |
|
|
11797
|
+
|
|
11798
|
+
\{ `bucket?`: `string`; `disposition?`: `string`; `length?`: `number`; `type?`: `string`; \}
|
|
11799
|
+
|
|
11800
|
+
设置 contentLength,如果是流模式则需要设置此项,也可以设置为对象参数
|
|
11801
|
+
|
|
11802
|
+
###### bucket?
|
|
11803
|
+
|
|
11804
|
+
`string`
|
|
11805
|
+
|
|
11806
|
+
###### disposition?
|
|
11807
|
+
|
|
11808
|
+
`string`
|
|
11809
|
+
|
|
11810
|
+
###### length?
|
|
11811
|
+
|
|
11812
|
+
`number`
|
|
11813
|
+
|
|
11814
|
+
###### type?
|
|
11815
|
+
|
|
11816
|
+
`string`
|
|
11817
|
+
|
|
11818
|
+
content-type,如 application/javascript
|
|
11797
11819
|
|
|
11798
11820
|
##### bucket?
|
|
11799
11821
|
|
|
@@ -11887,7 +11909,7 @@ lib/s3/functions/get.md
|
|
|
11887
11909
|
|
|
11888
11910
|
> **get**(`ctr`, `opt`): [`S3`](../classes/S3.md)
|
|
11889
11911
|
|
|
11890
|
-
Defined in: [lib/s3.ts:
|
|
11912
|
+
Defined in: [lib/s3.ts:241](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L241)
|
|
11891
11913
|
|
|
11892
11914
|
创建一个对象存储对象
|
|
11893
11915
|
|
|
@@ -14853,7 +14875,7 @@ lib/text/functions/getFilename.md
|
|
|
14853
14875
|
|
|
14854
14876
|
> **getFilename**(`path`): `string`
|
|
14855
14877
|
|
|
14856
|
-
Defined in: [lib/text.ts:
|
|
14878
|
+
Defined in: [lib/text.ts:497](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L497)
|
|
14857
14879
|
|
|
14858
14880
|
获取文件名
|
|
14859
14881
|
|
|
@@ -14882,7 +14904,7 @@ lib/text/functions/htmlescape.md
|
|
|
14882
14904
|
|
|
14883
14905
|
> **htmlescape**(`html`): `string`
|
|
14884
14906
|
|
|
14885
|
-
Defined in: [lib/text.ts:
|
|
14907
|
+
Defined in: [lib/text.ts:473](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L473)
|
|
14886
14908
|
|
|
14887
14909
|
HTML 特殊字符转换为实体字符
|
|
14888
14910
|
|
|
@@ -14911,7 +14933,7 @@ lib/text/functions/int2str.md
|
|
|
14911
14933
|
|
|
14912
14934
|
> **int2str**(`int`, `digits`, `decimal`): `string`
|
|
14913
14935
|
|
|
14914
|
-
Defined in: [lib/text.ts:
|
|
14936
|
+
Defined in: [lib/text.ts:688](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L688)
|
|
14915
14937
|
|
|
14916
14938
|
为解决精度问题,将整数转换为小数字符串
|
|
14917
14939
|
以下几个示例都是当 digits 为 3、decimal 为 2 时
|
|
@@ -14957,7 +14979,7 @@ lib/text/functions/isAscii.md
|
|
|
14957
14979
|
|
|
14958
14980
|
> **isAscii**(`text`): `boolean`
|
|
14959
14981
|
|
|
14960
|
-
Defined in: [lib/text.ts:
|
|
14982
|
+
Defined in: [lib/text.ts:255](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L255)
|
|
14961
14983
|
|
|
14962
14984
|
判断是否在 ascii 字符集内,仅可输入部分
|
|
14963
14985
|
|
|
@@ -14986,7 +15008,7 @@ lib/text/functions/isDomain.md
|
|
|
14986
15008
|
|
|
14987
15009
|
> **isDomain**(`domain`): `boolean`
|
|
14988
15010
|
|
|
14989
|
-
Defined in: [lib/text.ts:
|
|
15011
|
+
Defined in: [lib/text.ts:244](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L244)
|
|
14990
15012
|
|
|
14991
15013
|
判断是否是域名
|
|
14992
15014
|
|
|
@@ -15017,7 +15039,7 @@ lib/text/functions/isEMail.md
|
|
|
15017
15039
|
|
|
15018
15040
|
> **isEMail**(`email`): `boolean`
|
|
15019
15041
|
|
|
15020
|
-
Defined in: [lib/text.ts:
|
|
15042
|
+
Defined in: [lib/text.ts:213](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L213)
|
|
15021
15043
|
|
|
15022
15044
|
是否是邮件地址
|
|
15023
15045
|
|
|
@@ -15044,7 +15066,7 @@ lib/text/functions/isFalsy.md
|
|
|
15044
15066
|
|
|
15045
15067
|
> **isFalsy**(`val`): `val is TFalsy`
|
|
15046
15068
|
|
|
15047
|
-
Defined in: [lib/text.ts:
|
|
15069
|
+
Defined in: [lib/text.ts:639](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L639)
|
|
15048
15070
|
|
|
15049
15071
|
判断一个值是否是虚假的(为 null/undefined/空字符串/false/0)
|
|
15050
15072
|
|
|
@@ -15073,7 +15095,7 @@ lib/text/functions/isIdCardCN.md
|
|
|
15073
15095
|
|
|
15074
15096
|
> **isIdCardCN**(`idcard`): `boolean`
|
|
15075
15097
|
|
|
15076
|
-
Defined in: [lib/text.ts:
|
|
15098
|
+
Defined in: [lib/text.ts:367](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L367)
|
|
15077
15099
|
|
|
15078
15100
|
是否是中国大陆身份证号码
|
|
15079
15101
|
|
|
@@ -15102,7 +15124,7 @@ lib/text/functions/isIPv4.md
|
|
|
15102
15124
|
|
|
15103
15125
|
> **isIPv4**(`ip`): `boolean`
|
|
15104
15126
|
|
|
15105
|
-
Defined in: [lib/text.ts:
|
|
15127
|
+
Defined in: [lib/text.ts:223](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L223)
|
|
15106
15128
|
|
|
15107
15129
|
是否是 IPv4
|
|
15108
15130
|
|
|
@@ -15129,7 +15151,7 @@ lib/text/functions/isIPv6.md
|
|
|
15129
15151
|
|
|
15130
15152
|
> **isIPv6**(`ip`): `boolean`
|
|
15131
15153
|
|
|
15132
|
-
Defined in: [lib/text.ts:
|
|
15154
|
+
Defined in: [lib/text.ts:233](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L233)
|
|
15133
15155
|
|
|
15134
15156
|
是否是 IPv6
|
|
15135
15157
|
|
|
@@ -15156,7 +15178,7 @@ lib/text/functions/isPhoneCN.md
|
|
|
15156
15178
|
|
|
15157
15179
|
> **isPhoneCN**(`p`): `boolean`
|
|
15158
15180
|
|
|
15159
|
-
Defined in: [lib/text.ts:
|
|
15181
|
+
Defined in: [lib/text.ts:359](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L359)
|
|
15160
15182
|
|
|
15161
15183
|
判断手机号是否是 11 位,不做真实性校验
|
|
15162
15184
|
|
|
@@ -15185,7 +15207,7 @@ lib/text/functions/isRealPath.md
|
|
|
15185
15207
|
|
|
15186
15208
|
> **isRealPath**(`path`): `boolean`
|
|
15187
15209
|
|
|
15188
|
-
Defined in: [lib/text.ts:
|
|
15210
|
+
Defined in: [lib/text.ts:485](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L485)
|
|
15189
15211
|
|
|
15190
15212
|
判断是否是绝对路径,是返回 true,相对路径返回 false
|
|
15191
15213
|
|
|
@@ -15214,7 +15236,7 @@ lib/text/functions/isTruthy.md
|
|
|
15214
15236
|
|
|
15215
15237
|
> **isTruthy**\<`T`\>(`val`): `val is Exclude<T, TFalsy>`
|
|
15216
15238
|
|
|
15217
|
-
Defined in: [lib/text.ts:
|
|
15239
|
+
Defined in: [lib/text.ts:647](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L647)
|
|
15218
15240
|
|
|
15219
15241
|
判断一个值是否是真实的(不为 null/undefined/空字符串/false/0)
|
|
15220
15242
|
|
|
@@ -15249,7 +15271,7 @@ lib/text/functions/logicalOr.md
|
|
|
15249
15271
|
|
|
15250
15272
|
> **logicalOr**\<`T`, `T2`\>(`v1`, `v2`): `T` *extends* [`TFalsy`](../type-aliases/TFalsy.md) ? `T2` : `T`
|
|
15251
15273
|
|
|
15252
|
-
Defined in: [lib/text.ts:
|
|
15274
|
+
Defined in: [lib/text.ts:656](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L656)
|
|
15253
15275
|
|
|
15254
15276
|
类似 || 运算符的效果
|
|
15255
15277
|
|
|
@@ -15294,7 +15316,7 @@ lib/text/functions/match.md
|
|
|
15294
15316
|
|
|
15295
15317
|
> **match**(`str`, `regs`): `boolean`
|
|
15296
15318
|
|
|
15297
|
-
Defined in: [lib/text.ts:
|
|
15319
|
+
Defined in: [lib/text.ts:344](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L344)
|
|
15298
15320
|
|
|
15299
15321
|
传入正则进行匹配 str 是否有一项满足
|
|
15300
15322
|
|
|
@@ -15329,7 +15351,7 @@ lib/text/functions/nlReplace.md
|
|
|
15329
15351
|
|
|
15330
15352
|
> **nlReplace**(`str`, `to`): `string`
|
|
15331
15353
|
|
|
15332
|
-
Defined in: [lib/text.ts:
|
|
15354
|
+
Defined in: [lib/text.ts:264](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L264)
|
|
15333
15355
|
|
|
15334
15356
|
换行替换为别的
|
|
15335
15357
|
|
|
@@ -15364,7 +15386,7 @@ lib/text/functions/parseDomain.md
|
|
|
15364
15386
|
|
|
15365
15387
|
> **parseDomain**(`domain`): `Promise`\<[`IDomain`](../interfaces/IDomain.md)\>
|
|
15366
15388
|
|
|
15367
|
-
Defined in: [lib/text.ts:
|
|
15389
|
+
Defined in: [lib/text.ts:287](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L287)
|
|
15368
15390
|
|
|
15369
15391
|
解析域名并获取 tld/sld/domain/sub
|
|
15370
15392
|
|
|
@@ -15380,6 +15402,47 @@ Defined in: [lib/text.ts:266](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
15380
15402
|
|
|
15381
15403
|
`Promise`\<[`IDomain`](../interfaces/IDomain.md)\>
|
|
15382
15404
|
|
|
15405
|
+
lib/text/functions/parseHost.md
|
|
15406
|
+
---
|
|
15407
|
+
|
|
15408
|
+
[**Documents for @maiyunnet/kebab**](../../../index.md)
|
|
15409
|
+
|
|
15410
|
+
***
|
|
15411
|
+
|
|
15412
|
+
[Documents for @maiyunnet/kebab](../../../index.md) / [lib/text](../index.md) / parseHost
|
|
15413
|
+
|
|
15414
|
+
# Function: parseHost()
|
|
15415
|
+
|
|
15416
|
+
> **parseHost**(`host`): `object`
|
|
15417
|
+
|
|
15418
|
+
Defined in: [lib/text.ts:28](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L28)
|
|
15419
|
+
|
|
15420
|
+
解析主机名和端口号
|
|
15421
|
+
|
|
15422
|
+
## Parameters
|
|
15423
|
+
|
|
15424
|
+
### host
|
|
15425
|
+
|
|
15426
|
+
`string`
|
|
15427
|
+
|
|
15428
|
+
如 example.com:8080、[::1]:8080
|
|
15429
|
+
|
|
15430
|
+
## Returns
|
|
15431
|
+
|
|
15432
|
+
`object`
|
|
15433
|
+
|
|
15434
|
+
### hostname
|
|
15435
|
+
|
|
15436
|
+
> **hostname**: `string`
|
|
15437
|
+
|
|
15438
|
+
### port
|
|
15439
|
+
|
|
15440
|
+
> **port**: `string` \| `null`
|
|
15441
|
+
|
|
15442
|
+
### rawHostname
|
|
15443
|
+
|
|
15444
|
+
> **rawHostname**: `string`
|
|
15445
|
+
|
|
15383
15446
|
lib/text/functions/parseJson.md
|
|
15384
15447
|
---
|
|
15385
15448
|
|
|
@@ -15393,7 +15456,7 @@ lib/text/functions/parseJson.md
|
|
|
15393
15456
|
|
|
15394
15457
|
> **parseJson**(`str`): `any`
|
|
15395
15458
|
|
|
15396
|
-
Defined in: [lib/text.ts:
|
|
15459
|
+
Defined in: [lib/text.ts:550](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L550)
|
|
15397
15460
|
|
|
15398
15461
|
将字符串解析为对象,返回 false 代表解析失败,支持 BigInt
|
|
15399
15462
|
|
|
@@ -15422,7 +15485,7 @@ lib/text/functions/parseUrl.md
|
|
|
15422
15485
|
|
|
15423
15486
|
> **parseUrl**(`url`): [`IUrlParse`](../../../index/interfaces/IUrlParse.md)
|
|
15424
15487
|
|
|
15425
|
-
Defined in: [lib/text.ts:
|
|
15488
|
+
Defined in: [lib/text.ts:54](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L54)
|
|
15426
15489
|
|
|
15427
15490
|
格式化一段 URL
|
|
15428
15491
|
|
|
@@ -15449,7 +15512,7 @@ lib/text/functions/queryParse.md
|
|
|
15449
15512
|
|
|
15450
15513
|
> **queryParse**(`query`): `Record`\<`string`, `string` \| `string`[]\>
|
|
15451
15514
|
|
|
15452
|
-
Defined in: [lib/text.ts:
|
|
15515
|
+
Defined in: [lib/text.ts:436](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L436)
|
|
15453
15516
|
|
|
15454
15517
|
将 query string 转换为对象
|
|
15455
15518
|
|
|
@@ -15480,7 +15543,7 @@ lib/text/functions/queryStringify.md
|
|
|
15480
15543
|
|
|
15481
15544
|
> **queryStringify**(`query`, `encode?`): `string`
|
|
15482
15545
|
|
|
15483
|
-
Defined in: [lib/text.ts:
|
|
15546
|
+
Defined in: [lib/text.ts:395](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L395)
|
|
15484
15547
|
|
|
15485
15548
|
将对象转换为 query string
|
|
15486
15549
|
|
|
@@ -15506,7 +15569,7 @@ Defined in: [lib/text.ts:374](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
15506
15569
|
|
|
15507
15570
|
> **queryStringify**(`query`, `options`): `string`
|
|
15508
15571
|
|
|
15509
|
-
Defined in: [lib/text.ts:
|
|
15572
|
+
Defined in: [lib/text.ts:401](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L401)
|
|
15510
15573
|
|
|
15511
15574
|
将对象转换为 query string
|
|
15512
15575
|
|
|
@@ -15586,7 +15649,7 @@ lib/text/functions/str2int.md
|
|
|
15586
15649
|
|
|
15587
15650
|
> **str2int**(`str`, `digits`): `number`
|
|
15588
15651
|
|
|
15589
|
-
Defined in: [lib/text.ts:
|
|
15652
|
+
Defined in: [lib/text.ts:670](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L670)
|
|
15590
15653
|
|
|
15591
15654
|
为解决精度问题,将字符串数字转换为整数显示
|
|
15592
15655
|
以下几个示例都是当 digits 为 2 时
|
|
@@ -15626,7 +15689,7 @@ lib/text/functions/stringifyBuffer.md
|
|
|
15626
15689
|
|
|
15627
15690
|
> **stringifyBuffer**(`buf`): `string`
|
|
15628
15691
|
|
|
15629
|
-
Defined in: [lib/text.ts:
|
|
15692
|
+
Defined in: [lib/text.ts:593](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L593)
|
|
15630
15693
|
|
|
15631
15694
|
输出文本格式的 buffer
|
|
15632
15695
|
|
|
@@ -15655,7 +15718,7 @@ lib/text/functions/stringifyJson.md
|
|
|
15655
15718
|
|
|
15656
15719
|
> **stringifyJson**(`obj`, `space?`): `string`
|
|
15657
15720
|
|
|
15658
|
-
Defined in: [lib/text.ts:
|
|
15721
|
+
Defined in: [lib/text.ts:580](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L580)
|
|
15659
15722
|
|
|
15660
15723
|
将对象转换为 json 字符串,返回 false 代表解析失败,支持 BigInt
|
|
15661
15724
|
|
|
@@ -15690,7 +15753,7 @@ lib/text/functions/stringifyResult.md
|
|
|
15690
15753
|
|
|
15691
15754
|
> **stringifyResult**(`rtn`): `string`
|
|
15692
15755
|
|
|
15693
|
-
Defined in: [lib/text.ts:
|
|
15756
|
+
Defined in: [lib/text.ts:510](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L510)
|
|
15694
15757
|
|
|
15695
15758
|
将普通的返回 JSON 对象序列化为字符串
|
|
15696
15759
|
|
|
@@ -15719,7 +15782,7 @@ lib/text/functions/trimJson.md
|
|
|
15719
15782
|
|
|
15720
15783
|
> **trimJson**(`json`): `any`
|
|
15721
15784
|
|
|
15722
|
-
Defined in: [lib/text.ts:
|
|
15785
|
+
Defined in: [lib/text.ts:601](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L601)
|
|
15723
15786
|
|
|
15724
15787
|
递归删除 json 中的字符串首尾空格,会返回一个新的对象
|
|
15725
15788
|
|
|
@@ -15746,7 +15809,7 @@ lib/text/functions/urlAtom.md
|
|
|
15746
15809
|
|
|
15747
15810
|
> **urlAtom**(`url`): `string`
|
|
15748
15811
|
|
|
15749
|
-
Defined in: [lib/text.ts:
|
|
15812
|
+
Defined in: [lib/text.ts:194](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L194)
|
|
15750
15813
|
|
|
15751
15814
|
将路径中的 ../ ./ 都按规范妥善处理
|
|
15752
15815
|
|
|
@@ -15775,7 +15838,7 @@ lib/text/functions/urlResolve.md
|
|
|
15775
15838
|
|
|
15776
15839
|
> **urlResolve**(`from`, `to`): `string`
|
|
15777
15840
|
|
|
15778
|
-
Defined in: [lib/text.ts:
|
|
15841
|
+
Defined in: [lib/text.ts:132](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L132)
|
|
15779
15842
|
|
|
15780
15843
|
将相对路径根据基准路径进行转换
|
|
15781
15844
|
|
|
@@ -15843,6 +15906,7 @@ lib/text/index.md
|
|
|
15843
15906
|
- [match](functions/match.md)
|
|
15844
15907
|
- [nlReplace](functions/nlReplace.md)
|
|
15845
15908
|
- [parseDomain](functions/parseDomain.md)
|
|
15909
|
+
- [parseHost](functions/parseHost.md)
|
|
15846
15910
|
- [parseJson](functions/parseJson.md)
|
|
15847
15911
|
- [parseUrl](functions/parseUrl.md)
|
|
15848
15912
|
- [queryParse](functions/queryParse.md)
|
|
@@ -15867,7 +15931,7 @@ lib/text/interfaces/IDomain.md
|
|
|
15867
15931
|
|
|
15868
15932
|
# Interface: IDomain
|
|
15869
15933
|
|
|
15870
|
-
Defined in: [lib/text.ts:
|
|
15934
|
+
Defined in: [lib/text.ts:276](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L276)
|
|
15871
15935
|
|
|
15872
15936
|
解析后的 domain
|
|
15873
15937
|
|
|
@@ -15877,7 +15941,7 @@ Defined in: [lib/text.ts:255](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
15877
15941
|
|
|
15878
15942
|
> **domain**: `string` \| `null`
|
|
15879
15943
|
|
|
15880
|
-
Defined in: [lib/text.ts:
|
|
15944
|
+
Defined in: [lib/text.ts:279](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L279)
|
|
15881
15945
|
|
|
15882
15946
|
***
|
|
15883
15947
|
|
|
@@ -15885,7 +15949,7 @@ Defined in: [lib/text.ts:258](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
15885
15949
|
|
|
15886
15950
|
> **sld**: `string` \| `null`
|
|
15887
15951
|
|
|
15888
|
-
Defined in: [lib/text.ts:
|
|
15952
|
+
Defined in: [lib/text.ts:278](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L278)
|
|
15889
15953
|
|
|
15890
15954
|
***
|
|
15891
15955
|
|
|
@@ -15893,7 +15957,7 @@ Defined in: [lib/text.ts:257](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
15893
15957
|
|
|
15894
15958
|
> **sub**: `string` \| `null`
|
|
15895
15959
|
|
|
15896
|
-
Defined in: [lib/text.ts:
|
|
15960
|
+
Defined in: [lib/text.ts:280](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L280)
|
|
15897
15961
|
|
|
15898
15962
|
***
|
|
15899
15963
|
|
|
@@ -15901,7 +15965,7 @@ Defined in: [lib/text.ts:259](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
15901
15965
|
|
|
15902
15966
|
> **tld**: `string` \| `null`
|
|
15903
15967
|
|
|
15904
|
-
Defined in: [lib/text.ts:
|
|
15968
|
+
Defined in: [lib/text.ts:277](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L277)
|
|
15905
15969
|
|
|
15906
15970
|
lib/text/type-aliases/TFalsy.md
|
|
15907
15971
|
---
|
|
@@ -15916,7 +15980,7 @@ lib/text/type-aliases/TFalsy.md
|
|
|
15916
15980
|
|
|
15917
15981
|
> **TFalsy** = `false` \| `""` \| `0` \| `null` \| `undefined` \| *typeof* `NaN`
|
|
15918
15982
|
|
|
15919
|
-
Defined in: [lib/text.ts:
|
|
15983
|
+
Defined in: [lib/text.ts:633](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L633)
|
|
15920
15984
|
|
|
15921
15985
|
虚假值类型
|
|
15922
15986
|
|
|
@@ -15933,7 +15997,7 @@ lib/text/variables/REGEXP_ASCII.md
|
|
|
15933
15997
|
|
|
15934
15998
|
> `const` **REGEXP\_ASCII**: `RegExp`
|
|
15935
15999
|
|
|
15936
|
-
Defined in: [lib/text.ts:
|
|
16000
|
+
Defined in: [lib/text.ts:249](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L249)
|
|
15937
16001
|
|
|
15938
16002
|
可打印的 ascii 字符集
|
|
15939
16003
|
|
|
@@ -15950,7 +16014,7 @@ lib/text/variables/REGEXP_DOMAIN.md
|
|
|
15950
16014
|
|
|
15951
16015
|
> `const` **REGEXP\_DOMAIN**: `RegExp`
|
|
15952
16016
|
|
|
15953
|
-
Defined in: [lib/text.ts:
|
|
16017
|
+
Defined in: [lib/text.ts:237](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L237)
|
|
15954
16018
|
|
|
15955
16019
|
lib/text/variables/REGEXP_EMAIL.md
|
|
15956
16020
|
---
|
|
@@ -15965,7 +16029,7 @@ lib/text/variables/REGEXP_EMAIL.md
|
|
|
15965
16029
|
|
|
15966
16030
|
> `const` **REGEXP\_EMAIL**: `RegExp`
|
|
15967
16031
|
|
|
15968
|
-
Defined in: [lib/text.ts:
|
|
16032
|
+
Defined in: [lib/text.ts:207](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L207)
|
|
15969
16033
|
|
|
15970
16034
|
lib/text/variables/REGEXP_IPV4.md
|
|
15971
16035
|
---
|
|
@@ -15980,7 +16044,7 @@ lib/text/variables/REGEXP_IPV4.md
|
|
|
15980
16044
|
|
|
15981
16045
|
> `const` **REGEXP\_IPV4**: `RegExp`
|
|
15982
16046
|
|
|
15983
|
-
Defined in: [lib/text.ts:
|
|
16047
|
+
Defined in: [lib/text.ts:217](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L217)
|
|
15984
16048
|
|
|
15985
16049
|
lib/text/variables/REGEXP_IPV6.md
|
|
15986
16050
|
---
|
|
@@ -15995,7 +16059,7 @@ lib/text/variables/REGEXP_IPV6.md
|
|
|
15995
16059
|
|
|
15996
16060
|
> `const` **REGEXP\_IPV6**: `RegExp`
|
|
15997
16061
|
|
|
15998
|
-
Defined in: [lib/text.ts:
|
|
16062
|
+
Defined in: [lib/text.ts:227](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L227)
|
|
15999
16063
|
|
|
16000
16064
|
lib/time/classes/Time.md
|
|
16001
16065
|
---
|
|
@@ -16786,7 +16850,7 @@ Defined in: [lib/ws.ts:100](https://github.com/maiyunnet/kebab/blob/master/lib/w
|
|
|
16786
16850
|
|
|
16787
16851
|
> **get** **ended**(): `boolean`
|
|
16788
16852
|
|
|
16789
|
-
Defined in: [lib/ws.ts:
|
|
16853
|
+
Defined in: [lib/ws.ts:346](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L346)
|
|
16790
16854
|
|
|
16791
16855
|
当前是否已经结束读取,并且无法继续读取
|
|
16792
16856
|
|
|
@@ -16802,7 +16866,7 @@ Defined in: [lib/ws.ts:338](https://github.com/maiyunnet/kebab/blob/master/lib/w
|
|
|
16802
16866
|
|
|
16803
16867
|
> **get** **finished**(): `boolean`
|
|
16804
16868
|
|
|
16805
|
-
Defined in: [lib/ws.ts:
|
|
16869
|
+
Defined in: [lib/ws.ts:351](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L351)
|
|
16806
16870
|
|
|
16807
16871
|
当前是否已经结束写入,并且无法继续写入
|
|
16808
16872
|
|
|
@@ -16818,7 +16882,7 @@ Defined in: [lib/ws.ts:343](https://github.com/maiyunnet/kebab/blob/master/lib/w
|
|
|
16818
16882
|
|
|
16819
16883
|
> **get** **isServer**(): `boolean`
|
|
16820
16884
|
|
|
16821
|
-
Defined in: [lib/ws.ts:
|
|
16885
|
+
Defined in: [lib/ws.ts:358](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L358)
|
|
16822
16886
|
|
|
16823
16887
|
当前连接是不是服务器连接
|
|
16824
16888
|
|
|
@@ -16834,7 +16898,7 @@ Defined in: [lib/ws.ts:350](https://github.com/maiyunnet/kebab/blob/master/lib/w
|
|
|
16834
16898
|
|
|
16835
16899
|
> **get** **writable**(): `boolean`
|
|
16836
16900
|
|
|
16837
|
-
Defined in: [lib/ws.ts:
|
|
16901
|
+
Defined in: [lib/ws.ts:341](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L341)
|
|
16838
16902
|
|
|
16839
16903
|
当前是否是可写状态
|
|
16840
16904
|
|
|
@@ -16876,7 +16940,7 @@ Defined in: [lib/ws.ts:123](https://github.com/maiyunnet/kebab/blob/master/lib/w
|
|
|
16876
16940
|
|
|
16877
16941
|
> **destroy**(): `void`
|
|
16878
16942
|
|
|
16879
|
-
Defined in: [lib/ws.ts:
|
|
16943
|
+
Defined in: [lib/ws.ts:312](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L312)
|
|
16880
16944
|
|
|
16881
16945
|
#### Returns
|
|
16882
16946
|
|
|
@@ -16888,7 +16952,7 @@ Defined in: [lib/ws.ts:304](https://github.com/maiyunnet/kebab/blob/master/lib/w
|
|
|
16888
16952
|
|
|
16889
16953
|
> **end**(): `void`
|
|
16890
16954
|
|
|
16891
|
-
Defined in: [lib/ws.ts:
|
|
16955
|
+
Defined in: [lib/ws.ts:308](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L308)
|
|
16892
16956
|
|
|
16893
16957
|
#### Returns
|
|
16894
16958
|
|
|
@@ -16902,7 +16966,7 @@ Defined in: [lib/ws.ts:300](https://github.com/maiyunnet/kebab/blob/master/lib/w
|
|
|
16902
16966
|
|
|
16903
16967
|
> **on**(`event`, `cb`): `this`
|
|
16904
16968
|
|
|
16905
|
-
Defined in: [lib/ws.ts:
|
|
16969
|
+
Defined in: [lib/ws.ts:268](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L268)
|
|
16906
16970
|
|
|
16907
16971
|
绑定监听
|
|
16908
16972
|
|
|
@@ -16924,7 +16988,7 @@ Defined in: [lib/ws.ts:260](https://github.com/maiyunnet/kebab/blob/master/lib/w
|
|
|
16924
16988
|
|
|
16925
16989
|
> **on**(`event`, `cb`): `this`
|
|
16926
16990
|
|
|
16927
|
-
Defined in: [lib/ws.ts:
|
|
16991
|
+
Defined in: [lib/ws.ts:272](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L272)
|
|
16928
16992
|
|
|
16929
16993
|
绑定监听
|
|
16930
16994
|
|
|
@@ -16946,7 +17010,7 @@ Defined in: [lib/ws.ts:264](https://github.com/maiyunnet/kebab/blob/master/lib/w
|
|
|
16946
17010
|
|
|
16947
17011
|
> **on**(`event`, `cb`): `this`
|
|
16948
17012
|
|
|
16949
|
-
Defined in: [lib/ws.ts:
|
|
17013
|
+
Defined in: [lib/ws.ts:273](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L273)
|
|
16950
17014
|
|
|
16951
17015
|
绑定监听
|
|
16952
17016
|
|
|
@@ -16970,7 +17034,7 @@ Defined in: [lib/ws.ts:265](https://github.com/maiyunnet/kebab/blob/master/lib/w
|
|
|
16970
17034
|
|
|
16971
17035
|
> **ping**(`data?`): `boolean`
|
|
16972
17036
|
|
|
16973
|
-
Defined in: [lib/ws.ts:
|
|
17037
|
+
Defined in: [lib/ws.ts:363](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L363)
|
|
16974
17038
|
|
|
16975
17039
|
发送 ping
|
|
16976
17040
|
|
|
@@ -16990,7 +17054,7 @@ Defined in: [lib/ws.ts:355](https://github.com/maiyunnet/kebab/blob/master/lib/w
|
|
|
16990
17054
|
|
|
16991
17055
|
> **pong**(`data?`): `boolean`
|
|
16992
17056
|
|
|
16993
|
-
Defined in: [lib/ws.ts:
|
|
17057
|
+
Defined in: [lib/ws.ts:374](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L374)
|
|
16994
17058
|
|
|
16995
17059
|
发送 ping
|
|
16996
17060
|
|
|
@@ -17010,7 +17074,7 @@ Defined in: [lib/ws.ts:366](https://github.com/maiyunnet/kebab/blob/master/lib/w
|
|
|
17010
17074
|
|
|
17011
17075
|
> **writeBinary**(`data`): `boolean`
|
|
17012
17076
|
|
|
17013
|
-
Defined in: [lib/ws.ts:
|
|
17077
|
+
Defined in: [lib/ws.ts:333](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L333)
|
|
17014
17078
|
|
|
17015
17079
|
发送二进制
|
|
17016
17080
|
|
|
@@ -17030,7 +17094,7 @@ Defined in: [lib/ws.ts:325](https://github.com/maiyunnet/kebab/blob/master/lib/w
|
|
|
17030
17094
|
|
|
17031
17095
|
> **writeResult**(`data`): `boolean`
|
|
17032
17096
|
|
|
17033
|
-
Defined in: [lib/ws.ts:
|
|
17097
|
+
Defined in: [lib/ws.ts:325](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L325)
|
|
17034
17098
|
|
|
17035
17099
|
发送结果对象字符串
|
|
17036
17100
|
|
|
@@ -17050,7 +17114,7 @@ Defined in: [lib/ws.ts:317](https://github.com/maiyunnet/kebab/blob/master/lib/w
|
|
|
17050
17114
|
|
|
17051
17115
|
> **writeText**(`data`): `boolean`
|
|
17052
17116
|
|
|
17053
|
-
Defined in: [lib/ws.ts:
|
|
17117
|
+
Defined in: [lib/ws.ts:317](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L317)
|
|
17054
17118
|
|
|
17055
17119
|
发送文本
|
|
17056
17120
|
|
|
@@ -17179,7 +17243,7 @@ lib/ws/functions/connect.md
|
|
|
17179
17243
|
|
|
17180
17244
|
> **connect**(`u`, `opt`): `Promise`\<[`Socket`](../classes/Socket.md) \| `null`\>
|
|
17181
17245
|
|
|
17182
|
-
Defined in: [lib/ws.ts:
|
|
17246
|
+
Defined in: [lib/ws.ts:391](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L391)
|
|
17183
17247
|
|
|
17184
17248
|
创建一个 ws 客户端发起 ws 请求
|
|
17185
17249
|
|
|
@@ -17214,7 +17278,7 @@ lib/ws/functions/createServer.md
|
|
|
17214
17278
|
|
|
17215
17279
|
> **createServer**(`request`, `socket`, `head?`, `options?`): [`Socket`](../classes/Socket.md)
|
|
17216
17280
|
|
|
17217
|
-
Defined in: [lib/ws.ts:
|
|
17281
|
+
Defined in: [lib/ws.ts:401](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L401)
|
|
17218
17282
|
|
|
17219
17283
|
创建一个 ws 服务器接收处理器
|
|
17220
17284
|
|
|
@@ -17263,7 +17327,7 @@ lib/ws/functions/mproxy.md
|
|
|
17263
17327
|
|
|
17264
17328
|
> **mproxy**(`ctr`, `auth`, `opt`): `Promise`\<`number`\>
|
|
17265
17329
|
|
|
17266
|
-
Defined in: [lib/ws.ts:
|
|
17330
|
+
Defined in: [lib/ws.ts:489](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L489)
|
|
17267
17331
|
|
|
17268
17332
|
正向 mproxy 代理,读取 get 的 url 为实际请求地址
|
|
17269
17333
|
get: url, auth
|
|
@@ -17305,7 +17369,7 @@ lib/ws/functions/rproxy.md
|
|
|
17305
17369
|
|
|
17306
17370
|
> **rproxy**(`ctr`, `url`, `opt`): `Promise`\<`boolean`\>
|
|
17307
17371
|
|
|
17308
|
-
Defined in: [lib/ws.ts:
|
|
17372
|
+
Defined in: [lib/ws.ts:526](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L526)
|
|
17309
17373
|
|
|
17310
17374
|
反向代理,将本 socket 连接反代到其他网址,在 ws 的 onLoad 事件中使用
|
|
17311
17375
|
|
|
@@ -17346,7 +17410,7 @@ lib/ws/functions/rsocket.md
|
|
|
17346
17410
|
|
|
17347
17411
|
> **rsocket**(`ctr`, `host`, `port`): `Promise`\<`boolean`\>
|
|
17348
17412
|
|
|
17349
|
-
Defined in: [lib/ws.ts:
|
|
17413
|
+
Defined in: [lib/ws.ts:555](https://github.com/maiyunnet/kebab/blob/master/lib/ws.ts#L555)
|
|
17350
17414
|
|
|
17351
17415
|
反向代理,将本 websocket 连接反代到其他真正的 socket,在 ws 的 onLoad 事件中使用
|
|
17352
17416
|
|
|
@@ -19468,7 +19532,7 @@ Defined in: [sys/ctr.ts:173](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19468
19532
|
|
|
19469
19533
|
> `protected` **\_checkInput**(`input`, `rule`, `rtn`): `boolean`
|
|
19470
19534
|
|
|
19471
|
-
Defined in: [sys/ctr.ts:
|
|
19535
|
+
Defined in: [sys/ctr.ts:370](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L370)
|
|
19472
19536
|
|
|
19473
19537
|
检测提交的数据类型
|
|
19474
19538
|
|
|
@@ -19502,7 +19566,7 @@ Defined in: [sys/ctr.ts:361](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19502
19566
|
|
|
19503
19567
|
> `protected` **\_checkXInput**(`input`, `rule`, `rtn`): `boolean`
|
|
19504
19568
|
|
|
19505
|
-
Defined in: [sys/ctr.ts:
|
|
19569
|
+
Defined in: [sys/ctr.ts:538](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L538)
|
|
19506
19570
|
|
|
19507
19571
|
检测提交的数据类型(会检测 XSRF)
|
|
19508
19572
|
|
|
@@ -19536,7 +19600,7 @@ Defined in: [sys/ctr.ts:529](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19536
19600
|
|
|
19537
19601
|
> `protected` **\_cross**(): `boolean`
|
|
19538
19602
|
|
|
19539
|
-
Defined in: [sys/ctr.ts:
|
|
19603
|
+
Defined in: [sys/ctr.ts:752](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L752)
|
|
19540
19604
|
|
|
19541
19605
|
开启跨域请求
|
|
19542
19606
|
返回 true 接续执行,返回 false 需要中断用户本次访问(options请求)
|
|
@@ -19551,7 +19615,7 @@ Defined in: [sys/ctr.ts:743](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19551
19615
|
|
|
19552
19616
|
> `protected` **\_device**(): `"unknown"` \| `"android"` \| `"linux"` \| `"windows"` \| `"macintosh"` \| `"ipad"`
|
|
19553
19617
|
|
|
19554
|
-
Defined in: [sys/ctr.ts:
|
|
19618
|
+
Defined in: [sys/ctr.ts:577](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L577)
|
|
19555
19619
|
|
|
19556
19620
|
根据用户 ua 获取当前用户的设备类型
|
|
19557
19621
|
|
|
@@ -19565,7 +19629,7 @@ Defined in: [sys/ctr.ts:568](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19565
19629
|
|
|
19566
19630
|
> `protected` **\_enabledXsrf**(): `void`
|
|
19567
19631
|
|
|
19568
|
-
Defined in: [sys/ctr.ts:
|
|
19632
|
+
Defined in: [sys/ctr.ts:549](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L549)
|
|
19569
19633
|
|
|
19570
19634
|
当前页面开启 XSRF 支持(主要检测 cookie 是否存在)
|
|
19571
19635
|
如果当前页面有 CDN,请不要使用
|
|
@@ -19580,7 +19644,7 @@ Defined in: [sys/ctr.ts:540](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19580
19644
|
|
|
19581
19645
|
> `protected` **\_end**(): `void`
|
|
19582
19646
|
|
|
19583
|
-
Defined in: [sys/ctr.ts:
|
|
19647
|
+
Defined in: [sys/ctr.ts:835](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L835)
|
|
19584
19648
|
|
|
19585
19649
|
主动关闭当前 socket 连接
|
|
19586
19650
|
|
|
@@ -19594,7 +19658,7 @@ Defined in: [sys/ctr.ts:826](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19594
19658
|
|
|
19595
19659
|
> `protected` **\_getBasicAuth**(`user`, `pwd`): `string`
|
|
19596
19660
|
|
|
19597
|
-
Defined in: [sys/ctr.ts:
|
|
19661
|
+
Defined in: [sys/ctr.ts:570](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L570)
|
|
19598
19662
|
|
|
19599
19663
|
获取 Auth 字符串,用于客户端提交
|
|
19600
19664
|
|
|
@@ -19622,7 +19686,7 @@ Defined in: [sys/ctr.ts:561](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19622
19686
|
|
|
19623
19687
|
> `protected` **\_getLocale**(): `string`
|
|
19624
19688
|
|
|
19625
|
-
Defined in: [sys/ctr.ts:
|
|
19689
|
+
Defined in: [sys/ctr.ts:744](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L744)
|
|
19626
19690
|
|
|
19627
19691
|
获取当前语言名
|
|
19628
19692
|
|
|
@@ -19636,7 +19700,7 @@ Defined in: [sys/ctr.ts:735](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19636
19700
|
|
|
19637
19701
|
> `protected` **\_getLocaleJsonString**(): `string`
|
|
19638
19702
|
|
|
19639
|
-
Defined in: [sys/ctr.ts:
|
|
19703
|
+
Defined in: [sys/ctr.ts:732](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L732)
|
|
19640
19704
|
|
|
19641
19705
|
根据当前后台语言包设置情况获取 JSON 字符串传输到前台
|
|
19642
19706
|
|
|
@@ -19652,7 +19716,7 @@ string
|
|
|
19652
19716
|
|
|
19653
19717
|
> `protected` **\_getMemoryUsage**(): `number`
|
|
19654
19718
|
|
|
19655
|
-
Defined in: [sys/ctr.ts:
|
|
19719
|
+
Defined in: [sys/ctr.ts:323](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L323)
|
|
19656
19720
|
|
|
19657
19721
|
获取截止当前内存的使用情况
|
|
19658
19722
|
|
|
@@ -19666,7 +19730,7 @@ Defined in: [sys/ctr.ts:314](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19666
19730
|
|
|
19667
19731
|
> `protected` **\_getRunTime**(`ms`): `number`
|
|
19668
19732
|
|
|
19669
|
-
Defined in: [sys/ctr.ts:
|
|
19733
|
+
Defined in: [sys/ctr.ts:315](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L315)
|
|
19670
19734
|
|
|
19671
19735
|
获取截止当前时间的总运行时间
|
|
19672
19736
|
|
|
@@ -19688,7 +19752,7 @@ Defined in: [sys/ctr.ts:306](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19688
19752
|
|
|
19689
19753
|
> `protected` **\_handleFormData**(`events`): `Promise`\<`boolean`\>
|
|
19690
19754
|
|
|
19691
|
-
Defined in: [sys/ctr.ts:
|
|
19755
|
+
Defined in: [sys/ctr.ts:843](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L843)
|
|
19692
19756
|
|
|
19693
19757
|
获取 formdata 的信息
|
|
19694
19758
|
|
|
@@ -19720,7 +19784,7 @@ Defined in: [sys/ctr.ts:834](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19720
19784
|
|
|
19721
19785
|
> **\_l**(`key`, `data?`): `string`
|
|
19722
19786
|
|
|
19723
|
-
Defined in: [sys/ctr.ts:
|
|
19787
|
+
Defined in: [sys/ctr.ts:770](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L770)
|
|
19724
19788
|
|
|
19725
19789
|
获取语言包值
|
|
19726
19790
|
|
|
@@ -19746,7 +19810,7 @@ Defined in: [sys/ctr.ts:761](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19746
19810
|
|
|
19747
19811
|
> `protected` **\_loadData**(`path`): `Promise`\<`Record`\<`string`, `string`\> \| `null`\>
|
|
19748
19812
|
|
|
19749
|
-
Defined in: [sys/ctr.ts:
|
|
19813
|
+
Defined in: [sys/ctr.ts:635](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L635)
|
|
19750
19814
|
|
|
19751
19815
|
获取 data 数据
|
|
19752
19816
|
|
|
@@ -19768,7 +19832,7 @@ Defined in: [sys/ctr.ts:626](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19768
19832
|
|
|
19769
19833
|
> `protected` **\_loadLocale**(`loc`, `pkg`): `Promise`\<`boolean`\>
|
|
19770
19834
|
|
|
19771
|
-
Defined in: [sys/ctr.ts:
|
|
19835
|
+
Defined in: [sys/ctr.ts:683](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L683)
|
|
19772
19836
|
|
|
19773
19837
|
设定语言并加载语言包
|
|
19774
19838
|
|
|
@@ -19796,7 +19860,7 @@ Defined in: [sys/ctr.ts:674](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19796
19860
|
|
|
19797
19861
|
> `protected` **\_loadView**(`path`, `data`): `Promise`\<`string`\>
|
|
19798
19862
|
|
|
19799
|
-
Defined in: [sys/ctr.ts:
|
|
19863
|
+
Defined in: [sys/ctr.ts:332](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L332)
|
|
19800
19864
|
|
|
19801
19865
|
加载视图
|
|
19802
19866
|
|
|
@@ -19820,7 +19884,7 @@ Defined in: [sys/ctr.ts:323](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19820
19884
|
|
|
19821
19885
|
> `protected` **\_location**(`location`): `false`
|
|
19822
19886
|
|
|
19823
|
-
Defined in: [sys/ctr.ts:
|
|
19887
|
+
Defined in: [sys/ctr.ts:653](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L653)
|
|
19824
19888
|
|
|
19825
19889
|
跳转(302临时跳转),支持相对本项目根路径的路径或绝对路径
|
|
19826
19890
|
|
|
@@ -19842,7 +19906,7 @@ Defined in: [sys/ctr.ts:644](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19842
19906
|
|
|
19843
19907
|
> `protected` **\_ping**(`data?`): `boolean`
|
|
19844
19908
|
|
|
19845
|
-
Defined in: [sys/ctr.ts:
|
|
19909
|
+
Defined in: [sys/ctr.ts:820](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L820)
|
|
19846
19910
|
|
|
19847
19911
|
发送 socket ping
|
|
19848
19912
|
|
|
@@ -19864,7 +19928,7 @@ Defined in: [sys/ctr.ts:811](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19864
19928
|
|
|
19865
19929
|
> `protected` **\_pong**(`data?`): `boolean`
|
|
19866
19930
|
|
|
19867
|
-
Defined in: [sys/ctr.ts:
|
|
19931
|
+
Defined in: [sys/ctr.ts:828](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L828)
|
|
19868
19932
|
|
|
19869
19933
|
发送 socket pong
|
|
19870
19934
|
|
|
@@ -19886,7 +19950,7 @@ Defined in: [sys/ctr.ts:819](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19886
19950
|
|
|
19887
19951
|
> `protected` **\_startSession**(`link`, `auth`, `opt`): `Promise`\<`boolean`\>
|
|
19888
19952
|
|
|
19889
|
-
Defined in: [sys/ctr.ts:
|
|
19953
|
+
Defined in: [sys/ctr.ts:667](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L667)
|
|
19890
19954
|
|
|
19891
19955
|
开启 Session
|
|
19892
19956
|
|
|
@@ -19920,7 +19984,7 @@ name, ttl, ssl, sqlPre
|
|
|
19920
19984
|
|
|
19921
19985
|
> `protected` **\_writeBinary**(`data`): `boolean`
|
|
19922
19986
|
|
|
19923
|
-
Defined in: [sys/ctr.ts:
|
|
19987
|
+
Defined in: [sys/ctr.ts:812](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L812)
|
|
19924
19988
|
|
|
19925
19989
|
发送 socket 二进制
|
|
19926
19990
|
|
|
@@ -19942,7 +20006,7 @@ Defined in: [sys/ctr.ts:803](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19942
20006
|
|
|
19943
20007
|
> `protected` **\_writeResult**(`data`): `boolean`
|
|
19944
20008
|
|
|
19945
|
-
Defined in: [sys/ctr.ts:
|
|
20009
|
+
Defined in: [sys/ctr.ts:804](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L804)
|
|
19946
20010
|
|
|
19947
20011
|
发送结果对象文本
|
|
19948
20012
|
|
|
@@ -19964,7 +20028,7 @@ Defined in: [sys/ctr.ts:795](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19964
20028
|
|
|
19965
20029
|
> `protected` **\_writeText**(`data`): `boolean`
|
|
19966
20030
|
|
|
19967
|
-
Defined in: [sys/ctr.ts:
|
|
20031
|
+
Defined in: [sys/ctr.ts:796](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L796)
|
|
19968
20032
|
|
|
19969
20033
|
发送 socket 文本
|
|
19970
20034
|
|
|
@@ -19986,7 +20050,7 @@ Defined in: [sys/ctr.ts:787](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
19986
20050
|
|
|
19987
20051
|
> **getAuthorization**(): `string` \| `false` \| \{ `pwd`: `string`; `user`: `string`; \}
|
|
19988
20052
|
|
|
19989
|
-
Defined in: [sys/ctr.ts:
|
|
20053
|
+
Defined in: [sys/ctr.ts:598](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L598)
|
|
19990
20054
|
|
|
19991
20055
|
通过 header 或 _auth 获取鉴权信息或 JWT 信息(不解析)
|
|
19992
20056
|
|
|
@@ -20166,7 +20230,7 @@ Defined in: [sys/ctr.ts:205](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
20166
20230
|
|
|
20167
20231
|
> **onClose**(): `void` \| `Promise`\<`void`\>
|
|
20168
20232
|
|
|
20169
|
-
Defined in: [sys/ctr.ts:
|
|
20233
|
+
Defined in: [sys/ctr.ts:299](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L299)
|
|
20170
20234
|
|
|
20171
20235
|
WebSocket 下连接被终止后会自动被调用的事件,可重写此方法
|
|
20172
20236
|
|
|
@@ -20180,32 +20244,37 @@ WebSocket 下连接被终止后会自动被调用的事件,可重写此方法
|
|
|
20180
20244
|
|
|
20181
20245
|
> **onData**(`data`, `opcode`): `any`
|
|
20182
20246
|
|
|
20183
|
-
Defined in: [sys/ctr.ts:
|
|
20247
|
+
Defined in: [sys/ctr.ts:264](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L264)
|
|
20184
20248
|
|
|
20185
20249
|
WebSocket 下当收到数据时会自动被调用的事件,即只文本和二进制数据,返回内容会被发送给 socket
|
|
20186
|
-
但返回 false 连接会被中断,什么都不返回则什么都不做
|
|
20187
20250
|
|
|
20188
20251
|
#### Parameters
|
|
20189
20252
|
|
|
20190
20253
|
##### data
|
|
20191
20254
|
|
|
20255
|
+
数据
|
|
20256
|
+
|
|
20192
20257
|
`string` | `Buffer`\<`ArrayBufferLike`\>
|
|
20193
20258
|
|
|
20194
20259
|
##### opcode
|
|
20195
20260
|
|
|
20196
20261
|
[`EOpcode`](../../../lib/ws/enumerations/EOpcode.md)
|
|
20197
20262
|
|
|
20263
|
+
操作码
|
|
20264
|
+
|
|
20198
20265
|
#### Returns
|
|
20199
20266
|
|
|
20200
20267
|
`any`
|
|
20201
20268
|
|
|
20269
|
+
返回内容会被发送给 socket;若返回 false 则连接会被中断;不返回则不发送任何内容
|
|
20270
|
+
|
|
20202
20271
|
***
|
|
20203
20272
|
|
|
20204
20273
|
### onDrain()
|
|
20205
20274
|
|
|
20206
20275
|
> **onDrain**(): `void` \| `Promise`\<`void`\>
|
|
20207
20276
|
|
|
20208
|
-
Defined in: [sys/ctr.ts:
|
|
20277
|
+
Defined in: [sys/ctr.ts:285](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L285)
|
|
20209
20278
|
|
|
20210
20279
|
WebSocket 下连接恢复可写入状态后会调用此事件,可重写此方法
|
|
20211
20280
|
|
|
@@ -20219,7 +20288,7 @@ WebSocket 下连接恢复可写入状态后会调用此事件,可重写此方
|
|
|
20219
20288
|
|
|
20220
20289
|
> **onEnd**(): `void` \| `Promise`\<`void`\>
|
|
20221
20290
|
|
|
20222
|
-
Defined in: [sys/ctr.ts:
|
|
20291
|
+
Defined in: [sys/ctr.ts:292](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L292)
|
|
20223
20292
|
|
|
20224
20293
|
WebSocket 下连接被 end 后会自动被调用的事件,可重写此方法
|
|
20225
20294
|
|
|
@@ -20233,7 +20302,7 @@ WebSocket 下连接被 end 后会自动被调用的事件,可重写此方法
|
|
|
20233
20302
|
|
|
20234
20303
|
> **onLoad**(): `string` \| `boolean` \| [`DbValue`](../../../index/type-aliases/DbValue.md)[] \| `Promise`\<`string` \| `boolean` \| [`DbValue`](../../../index/type-aliases/DbValue.md)[]\>
|
|
20235
20304
|
|
|
20236
|
-
Defined in: [sys/ctr.ts:
|
|
20305
|
+
Defined in: [sys/ctr.ts:223](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L223)
|
|
20237
20306
|
|
|
20238
20307
|
实例化后会执行的方法,可重写此方法
|
|
20239
20308
|
|
|
@@ -20241,13 +20310,15 @@ Defined in: [sys/ctr.ts:222](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
20241
20310
|
|
|
20242
20311
|
`string` \| `boolean` \| [`DbValue`](../../../index/type-aliases/DbValue.md)[] \| `Promise`\<`string` \| `boolean` \| [`DbValue`](../../../index/type-aliases/DbValue.md)[]\>
|
|
20243
20312
|
|
|
20313
|
+
返回 true 或 undefined 则继续执行 onReady,否则中止且对应的返回值将作为输出结果(WebSocket 下中止将断开连接)
|
|
20314
|
+
|
|
20244
20315
|
***
|
|
20245
20316
|
|
|
20246
20317
|
### onMessage()
|
|
20247
20318
|
|
|
20248
20319
|
> **onMessage**(`data`, `opcode`): `boolean` \| `Promise`\<`boolean` \| `undefined`\> \| `undefined`
|
|
20249
20320
|
|
|
20250
|
-
Defined in: [sys/ctr.ts:
|
|
20321
|
+
Defined in: [sys/ctr.ts:276](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L276)
|
|
20251
20322
|
|
|
20252
20323
|
包含所有 opcode 的消息,若要发送数据需自行调用 write 方法,data 恒定为原始 buffer
|
|
20253
20324
|
返回 false 则不会执行默认方法,一般请什么都不要返回
|
|
@@ -20277,7 +20348,7 @@ opcode
|
|
|
20277
20348
|
|
|
20278
20349
|
> **onReady**(): `string` \| `boolean` \| [`DbValue`](../../../index/type-aliases/DbValue.md)[] \| `Promise`\<`string` \| `boolean` \| [`DbValue`](../../../index/type-aliases/DbValue.md)[]\>
|
|
20279
20350
|
|
|
20280
|
-
Defined in: [sys/ctr.ts:
|
|
20351
|
+
Defined in: [sys/ctr.ts:232](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L232)
|
|
20281
20352
|
|
|
20282
20353
|
onLoad 执行后会执行的方法,可重写此方法
|
|
20283
20354
|
|
|
@@ -20285,27 +20356,31 @@ onLoad 执行后会执行的方法,可重写此方法
|
|
|
20285
20356
|
|
|
20286
20357
|
`string` \| `boolean` \| [`DbValue`](../../../index/type-aliases/DbValue.md)[] \| `Promise`\<`string` \| `boolean` \| [`DbValue`](../../../index/type-aliases/DbValue.md)[]\>
|
|
20287
20358
|
|
|
20359
|
+
返回 true 或 undefined 则继续执行 action,否则中止且对应的返回值将作为输出结果(WebSocket 下中止将断开连接)
|
|
20360
|
+
|
|
20288
20361
|
***
|
|
20289
20362
|
|
|
20290
20363
|
### onReqStart()
|
|
20291
20364
|
|
|
20292
20365
|
> **onReqStart**(): `number` \| `Promise`\<`number`\>
|
|
20293
20366
|
|
|
20294
|
-
Defined in: [sys/ctr.ts:
|
|
20367
|
+
Defined in: [sys/ctr.ts:307](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L307)
|
|
20295
20368
|
|
|
20296
|
-
|
|
20369
|
+
请求发送开始时调用(仅会在 middle 内触发)
|
|
20297
20370
|
|
|
20298
20371
|
#### Returns
|
|
20299
20372
|
|
|
20300
20373
|
`number` \| `Promise`\<`number`\>
|
|
20301
20374
|
|
|
20375
|
+
1-自动处理 POST (默认),0-框架不自动处理 POST,-1-流程中断 (通常用于代理/反代场景)
|
|
20376
|
+
|
|
20302
20377
|
***
|
|
20303
20378
|
|
|
20304
20379
|
### onUnload()
|
|
20305
20380
|
|
|
20306
20381
|
> **onUnload**(`rtn`): `string` \| `boolean` \| [`DbValue`](../../../index/type-aliases/DbValue.md)[] \| `Promise`\<`string` \| `boolean` \| [`DbValue`](../../../index/type-aliases/DbValue.md)[]\>
|
|
20307
20382
|
|
|
20308
|
-
Defined in: [sys/ctr.ts:
|
|
20383
|
+
Defined in: [sys/ctr.ts:242](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L242)
|
|
20309
20384
|
|
|
20310
20385
|
整个结束前会执行本方法,可重写此方法对输出结果再处理一次(Websocket 模式无效)
|
|
20311
20386
|
|
|
@@ -20321,13 +20396,15 @@ Defined in: [sys/ctr.ts:239](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
20321
20396
|
|
|
20322
20397
|
`string` \| `boolean` \| [`DbValue`](../../../index/type-aliases/DbValue.md)[] \| `Promise`\<`string` \| `boolean` \| [`DbValue`](../../../index/type-aliases/DbValue.md)[]\>
|
|
20323
20398
|
|
|
20399
|
+
处理后的输出结果,将作为最终发送给客户端的内容
|
|
20400
|
+
|
|
20324
20401
|
***
|
|
20325
20402
|
|
|
20326
20403
|
### onUpgrade()
|
|
20327
20404
|
|
|
20328
20405
|
> **onUpgrade**(): `object`
|
|
20329
20406
|
|
|
20330
|
-
Defined in: [sys/ctr.ts:
|
|
20407
|
+
Defined in: [sys/ctr.ts:251](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L251)
|
|
20331
20408
|
|
|
20332
20409
|
WebSocket 下在建立 Server 连接之前可对 WebSocket 的信息进行配置
|
|
20333
20410
|
|
|
@@ -20335,6 +20412,8 @@ WebSocket 下在建立 Server 连接之前可对 WebSocket 的信息进行配置
|
|
|
20335
20412
|
|
|
20336
20413
|
`object`
|
|
20337
20414
|
|
|
20415
|
+
WebSocket 配置参数,包含自定义 header 和超时时间
|
|
20416
|
+
|
|
20338
20417
|
##### headers?
|
|
20339
20418
|
|
|
20340
20419
|
> `optional` **headers**: `OutgoingHttpHeaders`
|