@maiyunnet/kebab 9.12.2 → 9.13.1
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 +291 -91
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/s3.d.ts +39 -0
- package/lib/s3.js +40 -1
- package/lib/undici/response.d.ts +1 -1
- package/lib/undici.js +51 -29
- package/lib/zip.d.ts +2 -0
- package/package.json +1 -1
- package/sys/child.js +1 -1
- package/sys/ctr.d.ts +3 -3
package/doc/kebab-rag.md
CHANGED
|
@@ -1360,7 +1360,7 @@ index/variables/VER.md
|
|
|
1360
1360
|
|
|
1361
1361
|
# Variable: VER
|
|
1362
1362
|
|
|
1363
|
-
> `const` **VER**: `"9.
|
|
1363
|
+
> `const` **VER**: `"9.13.1"` = `'9.13.1'`
|
|
1364
1364
|
|
|
1365
1365
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1366
1366
|
|
|
@@ -12555,7 +12555,7 @@ lib/s3/classes/S3.md
|
|
|
12555
12555
|
|
|
12556
12556
|
# Class: S3
|
|
12557
12557
|
|
|
12558
|
-
Defined in: [lib/s3.ts:
|
|
12558
|
+
Defined in: [lib/s3.ts:79](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L79)
|
|
12559
12559
|
|
|
12560
12560
|
## Constructors
|
|
12561
12561
|
|
|
@@ -12563,7 +12563,7 @@ Defined in: [lib/s3.ts:43](https://github.com/maiyunnet/kebab/blob/master/lib/s3
|
|
|
12563
12563
|
|
|
12564
12564
|
> **new S3**(`ctr`, `opt`): `S3`
|
|
12565
12565
|
|
|
12566
|
-
Defined in: [lib/s3.ts:
|
|
12566
|
+
Defined in: [lib/s3.ts:88](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L88)
|
|
12567
12567
|
|
|
12568
12568
|
#### Parameters
|
|
12569
12569
|
|
|
@@ -12585,7 +12585,7 @@ Defined in: [lib/s3.ts:52](https://github.com/maiyunnet/kebab/blob/master/lib/s3
|
|
|
12585
12585
|
|
|
12586
12586
|
> **deleteObject**(`key`, `bucket?`): `Promise`\<`boolean`\>
|
|
12587
12587
|
|
|
12588
|
-
Defined in: [lib/s3.ts:
|
|
12588
|
+
Defined in: [lib/s3.ts:255](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L255)
|
|
12589
12589
|
|
|
12590
12590
|
删除对象
|
|
12591
12591
|
|
|
@@ -12613,7 +12613,7 @@ bucket 名
|
|
|
12613
12613
|
|
|
12614
12614
|
> **deleteObjects**(`keys`, `bucket?`): `Promise`\<`boolean`\>
|
|
12615
12615
|
|
|
12616
|
-
Defined in: [lib/s3.ts:
|
|
12616
|
+
Defined in: [lib/s3.ts:275](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L275)
|
|
12617
12617
|
|
|
12618
12618
|
批量删除对象
|
|
12619
12619
|
|
|
@@ -12641,7 +12641,7 @@ bucket 名
|
|
|
12641
12641
|
|
|
12642
12642
|
> **destroy**(): `void`
|
|
12643
12643
|
|
|
12644
|
-
Defined in: [lib/s3.ts:
|
|
12644
|
+
Defined in: [lib/s3.ts:317](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L317)
|
|
12645
12645
|
|
|
12646
12646
|
销毁连接,释放资源
|
|
12647
12647
|
一般会自动垃圾回收,但高频接口也可主动调用
|
|
@@ -12656,7 +12656,7 @@ Defined in: [lib/s3.ts:231](https://github.com/maiyunnet/kebab/blob/master/lib/s
|
|
|
12656
12656
|
|
|
12657
12657
|
> **getObject**(`key`, `bucket?`): `Promise`\<`false` \| `Readable` & `SdkStreamMixin` \| `Blob` & `SdkStreamMixin` \| `ReadableStream`\<`any`\> & `SdkStreamMixin` \| `undefined`\>
|
|
12658
12658
|
|
|
12659
|
-
Defined in: [lib/s3.ts:
|
|
12659
|
+
Defined in: [lib/s3.ts:235](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L235)
|
|
12660
12660
|
|
|
12661
12661
|
获取对象流,可通过流获取 buffer 或 text
|
|
12662
12662
|
|
|
@@ -12684,7 +12684,7 @@ bucket 名
|
|
|
12684
12684
|
|
|
12685
12685
|
> **headObject**(`key`, `bucket?`): `Promise`\<`false` \| `HeadObjectCommandOutput`\>
|
|
12686
12686
|
|
|
12687
|
-
Defined in: [lib/s3.ts:
|
|
12687
|
+
Defined in: [lib/s3.ts:297](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L297)
|
|
12688
12688
|
|
|
12689
12689
|
检测对象是否存在
|
|
12690
12690
|
|
|
@@ -12712,7 +12712,7 @@ bucket 名
|
|
|
12712
12712
|
|
|
12713
12713
|
> **putObject**(`key`, `content`, `length?`, `bucket?`): `Promise`\<`false` \| `CompleteMultipartUploadCommandOutput`\>
|
|
12714
12714
|
|
|
12715
|
-
Defined in: [lib/s3.ts:
|
|
12715
|
+
Defined in: [lib/s3.ts:139](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L139)
|
|
12716
12716
|
|
|
12717
12717
|
上传对象(可传流且也可无需设置 length) --
|
|
12718
12718
|
|
|
@@ -12776,11 +12776,39 @@ bucket 名
|
|
|
12776
12776
|
|
|
12777
12777
|
***
|
|
12778
12778
|
|
|
12779
|
+
### putObjects()
|
|
12780
|
+
|
|
12781
|
+
> **putObjects**(`items`, `options?`): `Promise`\<[`IPutObjectsItemResult`](../interfaces/IPutObjectsItemResult.md)[]\>
|
|
12782
|
+
|
|
12783
|
+
Defined in: [lib/s3.ts:184](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L184)
|
|
12784
|
+
|
|
12785
|
+
批量上传对象,并发控制,单次失败不影响其他项
|
|
12786
|
+
|
|
12787
|
+
#### Parameters
|
|
12788
|
+
|
|
12789
|
+
##### items
|
|
12790
|
+
|
|
12791
|
+
[`IPutObjectItem`](../interfaces/IPutObjectItem.md)[]
|
|
12792
|
+
|
|
12793
|
+
上传项列表
|
|
12794
|
+
|
|
12795
|
+
##### options?
|
|
12796
|
+
|
|
12797
|
+
[`IPutObjectsOptions`](../interfaces/IPutObjectsOptions.md)
|
|
12798
|
+
|
|
12799
|
+
批量上传选项
|
|
12800
|
+
|
|
12801
|
+
#### Returns
|
|
12802
|
+
|
|
12803
|
+
`Promise`\<[`IPutObjectsItemResult`](../interfaces/IPutObjectsItemResult.md)[]\>
|
|
12804
|
+
|
|
12805
|
+
***
|
|
12806
|
+
|
|
12779
12807
|
### setBucket()
|
|
12780
12808
|
|
|
12781
12809
|
> **setBucket**(`bucket`): `void`
|
|
12782
12810
|
|
|
12783
|
-
Defined in: [lib/s3.ts:
|
|
12811
|
+
Defined in: [lib/s3.ts:128](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L128)
|
|
12784
12812
|
|
|
12785
12813
|
修改预定义 bucket
|
|
12786
12814
|
|
|
@@ -12856,7 +12884,7 @@ lib/s3/functions/get.md
|
|
|
12856
12884
|
|
|
12857
12885
|
> **get**(`ctr`, `opt`): [`S3`](../classes/S3.md)
|
|
12858
12886
|
|
|
12859
|
-
Defined in: [lib/s3.ts:
|
|
12887
|
+
Defined in: [lib/s3.ts:327](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L327)
|
|
12860
12888
|
|
|
12861
12889
|
创建一个对象存储对象
|
|
12862
12890
|
|
|
@@ -12898,6 +12926,9 @@ lib/s3/index.md
|
|
|
12898
12926
|
## Interfaces
|
|
12899
12927
|
|
|
12900
12928
|
- [IOptions](interfaces/IOptions.md)
|
|
12929
|
+
- [IPutObjectItem](interfaces/IPutObjectItem.md)
|
|
12930
|
+
- [IPutObjectsItemResult](interfaces/IPutObjectsItemResult.md)
|
|
12931
|
+
- [IPutObjectsOptions](interfaces/IPutObjectsOptions.md)
|
|
12901
12932
|
|
|
12902
12933
|
## Functions
|
|
12903
12934
|
|
|
@@ -12978,6 +13009,171 @@ Defined in: [lib/s3.ts:30](https://github.com/maiyunnet/kebab/blob/master/lib/s3
|
|
|
12978
13009
|
|
|
12979
13010
|
服务商 -
|
|
12980
13011
|
|
|
13012
|
+
lib/s3/interfaces/IPutObjectItem.md
|
|
13013
|
+
---
|
|
13014
|
+
|
|
13015
|
+
[**Documents for @maiyunnet/kebab**](../../../index.md)
|
|
13016
|
+
|
|
13017
|
+
***
|
|
13018
|
+
|
|
13019
|
+
[Documents for @maiyunnet/kebab](../../../index.md) / [lib/s3](../index.md) / IPutObjectItem
|
|
13020
|
+
|
|
13021
|
+
# Interface: IPutObjectItem
|
|
13022
|
+
|
|
13023
|
+
Defined in: [lib/s3.ts:44](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L44)
|
|
13024
|
+
|
|
13025
|
+
批量上传单项
|
|
13026
|
+
|
|
13027
|
+
## Properties
|
|
13028
|
+
|
|
13029
|
+
### bucket?
|
|
13030
|
+
|
|
13031
|
+
> `optional` **bucket?**: `string`
|
|
13032
|
+
|
|
13033
|
+
Defined in: [lib/s3.ts:56](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L56)
|
|
13034
|
+
|
|
13035
|
+
bucket 名,优先级高于 options.bucket
|
|
13036
|
+
|
|
13037
|
+
***
|
|
13038
|
+
|
|
13039
|
+
### content
|
|
13040
|
+
|
|
13041
|
+
> **content**: `string` \| `Buffer`\<`ArrayBufferLike`\> \| `Readable`
|
|
13042
|
+
|
|
13043
|
+
Defined in: [lib/s3.ts:48](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L48)
|
|
13044
|
+
|
|
13045
|
+
内容
|
|
13046
|
+
|
|
13047
|
+
***
|
|
13048
|
+
|
|
13049
|
+
### disposition?
|
|
13050
|
+
|
|
13051
|
+
> `optional` **disposition?**: `string`
|
|
13052
|
+
|
|
13053
|
+
Defined in: [lib/s3.ts:54](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L54)
|
|
13054
|
+
|
|
13055
|
+
content-disposition
|
|
13056
|
+
|
|
13057
|
+
***
|
|
13058
|
+
|
|
13059
|
+
### key
|
|
13060
|
+
|
|
13061
|
+
> **key**: `string`
|
|
13062
|
+
|
|
13063
|
+
Defined in: [lib/s3.ts:46](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L46)
|
|
13064
|
+
|
|
13065
|
+
对象路径
|
|
13066
|
+
|
|
13067
|
+
***
|
|
13068
|
+
|
|
13069
|
+
### length?
|
|
13070
|
+
|
|
13071
|
+
> `optional` **length?**: `number`
|
|
13072
|
+
|
|
13073
|
+
Defined in: [lib/s3.ts:50](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L50)
|
|
13074
|
+
|
|
13075
|
+
contentLength,流模式需要设置
|
|
13076
|
+
|
|
13077
|
+
***
|
|
13078
|
+
|
|
13079
|
+
### type?
|
|
13080
|
+
|
|
13081
|
+
> `optional` **type?**: `string`
|
|
13082
|
+
|
|
13083
|
+
Defined in: [lib/s3.ts:52](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L52)
|
|
13084
|
+
|
|
13085
|
+
content-type,如 application/javascript
|
|
13086
|
+
|
|
13087
|
+
lib/s3/interfaces/IPutObjectsItemResult.md
|
|
13088
|
+
---
|
|
13089
|
+
|
|
13090
|
+
[**Documents for @maiyunnet/kebab**](../../../index.md)
|
|
13091
|
+
|
|
13092
|
+
***
|
|
13093
|
+
|
|
13094
|
+
[Documents for @maiyunnet/kebab](../../../index.md) / [lib/s3](../index.md) / IPutObjectsItemResult
|
|
13095
|
+
|
|
13096
|
+
# Interface: IPutObjectsItemResult
|
|
13097
|
+
|
|
13098
|
+
Defined in: [lib/s3.ts:68](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L68)
|
|
13099
|
+
|
|
13100
|
+
批量上传单项结果
|
|
13101
|
+
|
|
13102
|
+
## Properties
|
|
13103
|
+
|
|
13104
|
+
### error?
|
|
13105
|
+
|
|
13106
|
+
> `optional` **error?**: `string`
|
|
13107
|
+
|
|
13108
|
+
Defined in: [lib/s3.ts:76](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L76)
|
|
13109
|
+
|
|
13110
|
+
错误信息,失败时返回
|
|
13111
|
+
|
|
13112
|
+
***
|
|
13113
|
+
|
|
13114
|
+
### key
|
|
13115
|
+
|
|
13116
|
+
> **key**: `string`
|
|
13117
|
+
|
|
13118
|
+
Defined in: [lib/s3.ts:70](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L70)
|
|
13119
|
+
|
|
13120
|
+
对象路径
|
|
13121
|
+
|
|
13122
|
+
***
|
|
13123
|
+
|
|
13124
|
+
### location?
|
|
13125
|
+
|
|
13126
|
+
> `optional` **location?**: `string`
|
|
13127
|
+
|
|
13128
|
+
Defined in: [lib/s3.ts:74](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L74)
|
|
13129
|
+
|
|
13130
|
+
对象访问地址,成功时返回
|
|
13131
|
+
|
|
13132
|
+
***
|
|
13133
|
+
|
|
13134
|
+
### success
|
|
13135
|
+
|
|
13136
|
+
> **success**: `boolean`
|
|
13137
|
+
|
|
13138
|
+
Defined in: [lib/s3.ts:72](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L72)
|
|
13139
|
+
|
|
13140
|
+
是否成功
|
|
13141
|
+
|
|
13142
|
+
lib/s3/interfaces/IPutObjectsOptions.md
|
|
13143
|
+
---
|
|
13144
|
+
|
|
13145
|
+
[**Documents for @maiyunnet/kebab**](../../../index.md)
|
|
13146
|
+
|
|
13147
|
+
***
|
|
13148
|
+
|
|
13149
|
+
[Documents for @maiyunnet/kebab](../../../index.md) / [lib/s3](../index.md) / IPutObjectsOptions
|
|
13150
|
+
|
|
13151
|
+
# Interface: IPutObjectsOptions
|
|
13152
|
+
|
|
13153
|
+
Defined in: [lib/s3.ts:60](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L60)
|
|
13154
|
+
|
|
13155
|
+
批量上传选项
|
|
13156
|
+
|
|
13157
|
+
## Properties
|
|
13158
|
+
|
|
13159
|
+
### bucket?
|
|
13160
|
+
|
|
13161
|
+
> `optional` **bucket?**: `string`
|
|
13162
|
+
|
|
13163
|
+
Defined in: [lib/s3.ts:64](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L64)
|
|
13164
|
+
|
|
13165
|
+
bucket 名
|
|
13166
|
+
|
|
13167
|
+
***
|
|
13168
|
+
|
|
13169
|
+
### concurrency?
|
|
13170
|
+
|
|
13171
|
+
> `optional` **concurrency?**: `number`
|
|
13172
|
+
|
|
13173
|
+
Defined in: [lib/s3.ts:62](https://github.com/maiyunnet/kebab/blob/master/lib/s3.ts#L62)
|
|
13174
|
+
|
|
13175
|
+
并发数,默认 5
|
|
13176
|
+
|
|
12981
13177
|
lib/scan/classes/Scan.md
|
|
12982
13178
|
---
|
|
12983
13179
|
|
|
@@ -18266,7 +18462,7 @@ lib/undici/functions/mproxyData.md
|
|
|
18266
18462
|
|
|
18267
18463
|
> **mproxyData**(`ctr`): `any`
|
|
18268
18464
|
|
|
18269
|
-
Defined in: [lib/undici.ts:
|
|
18465
|
+
Defined in: [lib/undici.ts:633](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L633)
|
|
18270
18466
|
|
|
18271
18467
|
获取 mproxy 的附加数据
|
|
18272
18468
|
|
|
@@ -18295,7 +18491,7 @@ lib/undici/functions/mproxy.md
|
|
|
18295
18491
|
|
|
18296
18492
|
> **mproxy**(`ctr`, `auth`, `opt?`): `Promise`\<`number`\>
|
|
18297
18493
|
|
|
18298
|
-
Defined in: [lib/undici.ts:
|
|
18494
|
+
Defined in: [lib/undici.ts:571](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L571)
|
|
18299
18495
|
|
|
18300
18496
|
正向 mproxy 代理,注意提前处理不要自动处理 post 数据,读取 get 的 url 为实际请求地址
|
|
18301
18497
|
get: url, auth
|
|
@@ -18524,7 +18720,7 @@ lib/undici/functions/rproxy.md
|
|
|
18524
18720
|
|
|
18525
18721
|
> **rproxy**(`ctr`, `route`, `opt?`): `Promise`\<`boolean`\>
|
|
18526
18722
|
|
|
18527
|
-
Defined in: [lib/undici.ts:
|
|
18723
|
+
Defined in: [lib/undici.ts:663](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L663)
|
|
18528
18724
|
|
|
18529
18725
|
反向代理,将本服务器的某个路由反代到其他网址
|
|
18530
18726
|
|
|
@@ -18612,7 +18808,7 @@ lib/undici/interfaces/IMproxyOptions.md
|
|
|
18612
18808
|
|
|
18613
18809
|
# Interface: IMproxyOptions
|
|
18614
18810
|
|
|
18615
|
-
Defined in: [lib/undici.ts:
|
|
18811
|
+
Defined in: [lib/undici.ts:780](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L780)
|
|
18616
18812
|
|
|
18617
18813
|
正向代理请求的传入参数选项
|
|
18618
18814
|
|
|
@@ -18622,7 +18818,7 @@ Defined in: [lib/undici.ts:758](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18622
18818
|
|
|
18623
18819
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
18624
18820
|
|
|
18625
|
-
Defined in: [lib/undici.ts:
|
|
18821
|
+
Defined in: [lib/undici.ts:789](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L789)
|
|
18626
18822
|
|
|
18627
18823
|
过滤 header,返回 true 则留下
|
|
18628
18824
|
|
|
@@ -18642,7 +18838,7 @@ Defined in: [lib/undici.ts:767](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18642
18838
|
|
|
18643
18839
|
> `optional` **follow?**: `number`
|
|
18644
18840
|
|
|
18645
|
-
Defined in: [lib/undici.ts:
|
|
18841
|
+
Defined in: [lib/undici.ts:783](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L783)
|
|
18646
18842
|
|
|
18647
18843
|
***
|
|
18648
18844
|
|
|
@@ -18650,7 +18846,7 @@ Defined in: [lib/undici.ts:761](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18650
18846
|
|
|
18651
18847
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18652
18848
|
|
|
18653
|
-
Defined in: [lib/undici.ts:
|
|
18849
|
+
Defined in: [lib/undici.ts:787](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L787)
|
|
18654
18850
|
|
|
18655
18851
|
***
|
|
18656
18852
|
|
|
@@ -18658,7 +18854,7 @@ Defined in: [lib/undici.ts:765](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18658
18854
|
|
|
18659
18855
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18660
18856
|
|
|
18661
|
-
Defined in: [lib/undici.ts:
|
|
18857
|
+
Defined in: [lib/undici.ts:785](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L785)
|
|
18662
18858
|
|
|
18663
18859
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18664
18860
|
|
|
@@ -18668,7 +18864,7 @@ Defined in: [lib/undici.ts:763](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18668
18864
|
|
|
18669
18865
|
> `optional` **local?**: `string`
|
|
18670
18866
|
|
|
18671
|
-
Defined in: [lib/undici.ts:
|
|
18867
|
+
Defined in: [lib/undici.ts:786](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L786)
|
|
18672
18868
|
|
|
18673
18869
|
***
|
|
18674
18870
|
|
|
@@ -18676,7 +18872,7 @@ Defined in: [lib/undici.ts:764](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18676
18872
|
|
|
18677
18873
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
18678
18874
|
|
|
18679
|
-
Defined in: [lib/undici.ts:
|
|
18875
|
+
Defined in: [lib/undici.ts:791](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L791)
|
|
18680
18876
|
|
|
18681
18877
|
默认为 default
|
|
18682
18878
|
|
|
@@ -18686,7 +18882,7 @@ Defined in: [lib/undici.ts:769](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18686
18882
|
|
|
18687
18883
|
> `optional` **timeout?**: `number`
|
|
18688
18884
|
|
|
18689
|
-
Defined in: [lib/undici.ts:
|
|
18885
|
+
Defined in: [lib/undici.ts:782](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L782)
|
|
18690
18886
|
|
|
18691
18887
|
秒数,默认 300 秒
|
|
18692
18888
|
|
|
@@ -18701,7 +18897,7 @@ lib/undici/interfaces/IRequestOptions.md
|
|
|
18701
18897
|
|
|
18702
18898
|
# Interface: IRequestOptions
|
|
18703
18899
|
|
|
18704
|
-
Defined in: [lib/undici.ts:
|
|
18900
|
+
Defined in: [lib/undici.ts:747](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L747)
|
|
18705
18901
|
|
|
18706
18902
|
请求的传入参数选项
|
|
18707
18903
|
|
|
@@ -18711,7 +18907,7 @@ Defined in: [lib/undici.ts:725](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18711
18907
|
|
|
18712
18908
|
> `optional` **cookie?**: `Record`\<`string`, [`ICookie`](../../cookie/interfaces/ICookie.md)\>
|
|
18713
18909
|
|
|
18714
|
-
Defined in: [lib/undici.ts:
|
|
18910
|
+
Defined in: [lib/undici.ts:772](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L772)
|
|
18715
18911
|
|
|
18716
18912
|
cookie 托管对象
|
|
18717
18913
|
|
|
@@ -18721,7 +18917,7 @@ cookie 托管对象
|
|
|
18721
18917
|
|
|
18722
18918
|
> `optional` **follow?**: `number`
|
|
18723
18919
|
|
|
18724
|
-
Defined in: [lib/undici.ts:
|
|
18920
|
+
Defined in: [lib/undici.ts:753](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L753)
|
|
18725
18921
|
|
|
18726
18922
|
追踪 location 次数,0 为不追踪,默认为 0
|
|
18727
18923
|
|
|
@@ -18731,7 +18927,7 @@ Defined in: [lib/undici.ts:731](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18731
18927
|
|
|
18732
18928
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18733
18929
|
|
|
18734
|
-
Defined in: [lib/undici.ts:
|
|
18930
|
+
Defined in: [lib/undici.ts:758](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L758)
|
|
18735
18931
|
|
|
18736
18932
|
***
|
|
18737
18933
|
|
|
@@ -18739,7 +18935,7 @@ Defined in: [lib/undici.ts:736](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18739
18935
|
|
|
18740
18936
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18741
18937
|
|
|
18742
|
-
Defined in: [lib/undici.ts:
|
|
18938
|
+
Defined in: [lib/undici.ts:755](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L755)
|
|
18743
18939
|
|
|
18744
18940
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18745
18941
|
|
|
@@ -18749,7 +18945,7 @@ Defined in: [lib/undici.ts:733](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18749
18945
|
|
|
18750
18946
|
> `optional` **keep?**: `boolean`
|
|
18751
18947
|
|
|
18752
|
-
Defined in: [lib/undici.ts:
|
|
18948
|
+
Defined in: [lib/undici.ts:768](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L768)
|
|
18753
18949
|
|
|
18754
18950
|
连接是否保持长连接(即是否允许复用),默认为 true
|
|
18755
18951
|
|
|
@@ -18759,7 +18955,7 @@ Defined in: [lib/undici.ts:746](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18759
18955
|
|
|
18760
18956
|
> `optional` **local?**: `string`
|
|
18761
18957
|
|
|
18762
|
-
Defined in: [lib/undici.ts:
|
|
18958
|
+
Defined in: [lib/undici.ts:757](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L757)
|
|
18763
18959
|
|
|
18764
18960
|
***
|
|
18765
18961
|
|
|
@@ -18767,7 +18963,7 @@ Defined in: [lib/undici.ts:735](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18767
18963
|
|
|
18768
18964
|
> `optional` **log?**: `boolean`
|
|
18769
18965
|
|
|
18770
|
-
Defined in: [lib/undici.ts:
|
|
18966
|
+
Defined in: [lib/undici.ts:774](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L774)
|
|
18771
18967
|
|
|
18772
18968
|
若有异常写入文件日志,默认为 true
|
|
18773
18969
|
|
|
@@ -18777,7 +18973,7 @@ Defined in: [lib/undici.ts:752](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18777
18973
|
|
|
18778
18974
|
> `optional` **method?**: `"GET"` \| `"POST"` \| `"PUT"` \| `"DELETE"` \| `"OPTIONS"`
|
|
18779
18975
|
|
|
18780
|
-
Defined in: [lib/undici.ts:
|
|
18976
|
+
Defined in: [lib/undici.ts:748](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L748)
|
|
18781
18977
|
|
|
18782
18978
|
***
|
|
18783
18979
|
|
|
@@ -18785,7 +18981,7 @@ Defined in: [lib/undici.ts:726](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18785
18981
|
|
|
18786
18982
|
> `optional` **mproxy?**: `object`
|
|
18787
18983
|
|
|
18788
|
-
Defined in: [lib/undici.ts:
|
|
18984
|
+
Defined in: [lib/undici.ts:760](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L760)
|
|
18789
18985
|
|
|
18790
18986
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
18791
18987
|
|
|
@@ -18813,7 +19009,7 @@ Defined in: [lib/undici.ts:738](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18813
19009
|
|
|
18814
19010
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
18815
19011
|
|
|
18816
|
-
Defined in: [lib/undici.ts:
|
|
19012
|
+
Defined in: [lib/undici.ts:770](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L770)
|
|
18817
19013
|
|
|
18818
19014
|
复用池名/Agent,默认为 default
|
|
18819
19015
|
|
|
@@ -18823,7 +19019,7 @@ Defined in: [lib/undici.ts:748](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18823
19019
|
|
|
18824
19020
|
> `optional` **save?**: `string`
|
|
18825
19021
|
|
|
18826
|
-
Defined in: [lib/undici.ts:
|
|
19022
|
+
Defined in: [lib/undici.ts:756](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L756)
|
|
18827
19023
|
|
|
18828
19024
|
***
|
|
18829
19025
|
|
|
@@ -18831,7 +19027,7 @@ Defined in: [lib/undici.ts:734](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18831
19027
|
|
|
18832
19028
|
> `optional` **signal?**: `AbortSignal`
|
|
18833
19029
|
|
|
18834
|
-
Defined in: [lib/undici.ts:
|
|
19030
|
+
Defined in: [lib/undici.ts:776](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L776)
|
|
18835
19031
|
|
|
18836
19032
|
请求中止信号
|
|
18837
19033
|
|
|
@@ -18841,7 +19037,7 @@ Defined in: [lib/undici.ts:754](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18841
19037
|
|
|
18842
19038
|
> `optional` **timeout?**: `number`
|
|
18843
19039
|
|
|
18844
|
-
Defined in: [lib/undici.ts:
|
|
19040
|
+
Defined in: [lib/undici.ts:751](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L751)
|
|
18845
19041
|
|
|
18846
19042
|
秒数,默认 300 秒
|
|
18847
19043
|
|
|
@@ -18851,7 +19047,7 @@ Defined in: [lib/undici.ts:729](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18851
19047
|
|
|
18852
19048
|
> `optional` **type?**: `"form"` \| `"json"`
|
|
18853
19049
|
|
|
18854
|
-
Defined in: [lib/undici.ts:
|
|
19050
|
+
Defined in: [lib/undici.ts:749](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L749)
|
|
18855
19051
|
|
|
18856
19052
|
lib/undici/interfaces/IRproxyOptions.md
|
|
18857
19053
|
---
|
|
@@ -18864,7 +19060,7 @@ lib/undici/interfaces/IRproxyOptions.md
|
|
|
18864
19060
|
|
|
18865
19061
|
# Interface: IRproxyOptions
|
|
18866
19062
|
|
|
18867
|
-
Defined in: [lib/undici.ts:
|
|
19063
|
+
Defined in: [lib/undici.ts:795](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L795)
|
|
18868
19064
|
|
|
18869
19065
|
反向代理请求的传入参数选项
|
|
18870
19066
|
|
|
@@ -18874,7 +19070,7 @@ Defined in: [lib/undici.ts:773](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18874
19070
|
|
|
18875
19071
|
> `optional` **body?**: `string` \| `Buffer`\<`ArrayBufferLike`\> \| `Readable`
|
|
18876
19072
|
|
|
18877
|
-
Defined in: [lib/undici.ts:
|
|
19073
|
+
Defined in: [lib/undici.ts:814](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L814)
|
|
18878
19074
|
|
|
18879
19075
|
手动传入请求体(优先于原始 req 流),用于 req 流已消费后仍需转发 body 的场景
|
|
18880
19076
|
|
|
@@ -18884,7 +19080,7 @@ Defined in: [lib/undici.ts:792](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18884
19080
|
|
|
18885
19081
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
18886
19082
|
|
|
18887
|
-
Defined in: [lib/undici.ts:
|
|
19083
|
+
Defined in: [lib/undici.ts:804](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L804)
|
|
18888
19084
|
|
|
18889
19085
|
过滤 header,返回 true 则留下
|
|
18890
19086
|
|
|
@@ -18904,7 +19100,7 @@ Defined in: [lib/undici.ts:782](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18904
19100
|
|
|
18905
19101
|
> `optional` **follow?**: `number`
|
|
18906
19102
|
|
|
18907
|
-
Defined in: [lib/undici.ts:
|
|
19103
|
+
Defined in: [lib/undici.ts:798](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L798)
|
|
18908
19104
|
|
|
18909
19105
|
***
|
|
18910
19106
|
|
|
@@ -18912,7 +19108,7 @@ Defined in: [lib/undici.ts:776](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18912
19108
|
|
|
18913
19109
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18914
19110
|
|
|
18915
|
-
Defined in: [lib/undici.ts:
|
|
19111
|
+
Defined in: [lib/undici.ts:802](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L802)
|
|
18916
19112
|
|
|
18917
19113
|
***
|
|
18918
19114
|
|
|
@@ -18920,7 +19116,7 @@ Defined in: [lib/undici.ts:780](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18920
19116
|
|
|
18921
19117
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18922
19118
|
|
|
18923
|
-
Defined in: [lib/undici.ts:
|
|
19119
|
+
Defined in: [lib/undici.ts:800](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L800)
|
|
18924
19120
|
|
|
18925
19121
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18926
19122
|
|
|
@@ -18930,7 +19126,7 @@ Defined in: [lib/undici.ts:778](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18930
19126
|
|
|
18931
19127
|
> `optional` **local?**: `string`
|
|
18932
19128
|
|
|
18933
|
-
Defined in: [lib/undici.ts:
|
|
19129
|
+
Defined in: [lib/undici.ts:801](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L801)
|
|
18934
19130
|
|
|
18935
19131
|
***
|
|
18936
19132
|
|
|
@@ -18938,7 +19134,7 @@ Defined in: [lib/undici.ts:779](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18938
19134
|
|
|
18939
19135
|
> `optional` **mproxy?**: `object`
|
|
18940
19136
|
|
|
18941
|
-
Defined in: [lib/undici.ts:
|
|
19137
|
+
Defined in: [lib/undici.ts:806](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L806)
|
|
18942
19138
|
|
|
18943
19139
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
18944
19140
|
|
|
@@ -18966,7 +19162,7 @@ Defined in: [lib/undici.ts:784](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18966
19162
|
|
|
18967
19163
|
> `optional` **querys?**: `Record`\<`string`, `any`\>
|
|
18968
19164
|
|
|
18969
|
-
Defined in: [lib/undici.ts:
|
|
19165
|
+
Defined in: [lib/undici.ts:816](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L816)
|
|
18970
19166
|
|
|
18971
19167
|
自定义 GET 查询参数,传入后直接替换代理目标 URL 的整个 query string
|
|
18972
19168
|
|
|
@@ -18976,7 +19172,7 @@ Defined in: [lib/undici.ts:794](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18976
19172
|
|
|
18977
19173
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
18978
19174
|
|
|
18979
|
-
Defined in: [lib/undici.ts:
|
|
19175
|
+
Defined in: [lib/undici.ts:818](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L818)
|
|
18980
19176
|
|
|
18981
19177
|
默认为 default
|
|
18982
19178
|
|
|
@@ -18986,7 +19182,7 @@ Defined in: [lib/undici.ts:796](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18986
19182
|
|
|
18987
19183
|
> `optional` **timeout?**: `number`
|
|
18988
19184
|
|
|
18989
|
-
Defined in: [lib/undici.ts:
|
|
19185
|
+
Defined in: [lib/undici.ts:797](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L797)
|
|
18990
19186
|
|
|
18991
19187
|
秒数,默认 300 秒
|
|
18992
19188
|
|
|
@@ -19475,7 +19671,7 @@ lib/undici/type-aliases/THttpHeaders.md
|
|
|
19475
19671
|
|
|
19476
19672
|
> **THttpHeaders** = `http.IncomingHttpHeaders` & `object`
|
|
19477
19673
|
|
|
19478
|
-
Defined in: [lib/undici.ts:
|
|
19674
|
+
Defined in: [lib/undici.ts:823](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L823)
|
|
19479
19675
|
|
|
19480
19676
|
http headers
|
|
19481
19677
|
|
|
@@ -21218,7 +21414,7 @@ lib/zip/interfaces/IZipInputByType.md
|
|
|
21218
21414
|
|
|
21219
21415
|
# Interface: IZipInputByType
|
|
21220
21416
|
|
|
21221
|
-
Defined in: [lib/zip.ts:
|
|
21417
|
+
Defined in: [lib/zip.ts:477](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L477)
|
|
21222
21418
|
|
|
21223
21419
|
## Properties
|
|
21224
21420
|
|
|
@@ -21226,7 +21422,7 @@ Defined in: [lib/zip.ts:475](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21226
21422
|
|
|
21227
21423
|
> **array**: `number`[]
|
|
21228
21424
|
|
|
21229
|
-
Defined in: [lib/zip.ts:
|
|
21425
|
+
Defined in: [lib/zip.ts:482](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L482)
|
|
21230
21426
|
|
|
21231
21427
|
***
|
|
21232
21428
|
|
|
@@ -21234,7 +21430,7 @@ Defined in: [lib/zip.ts:480](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21234
21430
|
|
|
21235
21431
|
> **arraybuffer**: `ArrayBuffer`
|
|
21236
21432
|
|
|
21237
|
-
Defined in: [lib/zip.ts:
|
|
21433
|
+
Defined in: [lib/zip.ts:484](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L484)
|
|
21238
21434
|
|
|
21239
21435
|
***
|
|
21240
21436
|
|
|
@@ -21242,7 +21438,7 @@ Defined in: [lib/zip.ts:482](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21242
21438
|
|
|
21243
21439
|
> **base64**: `string`
|
|
21244
21440
|
|
|
21245
|
-
Defined in: [lib/zip.ts:
|
|
21441
|
+
Defined in: [lib/zip.ts:478](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L478)
|
|
21246
21442
|
|
|
21247
21443
|
***
|
|
21248
21444
|
|
|
@@ -21250,7 +21446,7 @@ Defined in: [lib/zip.ts:476](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21250
21446
|
|
|
21251
21447
|
> **binarystring**: `string`
|
|
21252
21448
|
|
|
21253
|
-
Defined in: [lib/zip.ts:
|
|
21449
|
+
Defined in: [lib/zip.ts:481](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L481)
|
|
21254
21450
|
|
|
21255
21451
|
***
|
|
21256
21452
|
|
|
@@ -21258,7 +21454,7 @@ Defined in: [lib/zip.ts:479](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21258
21454
|
|
|
21259
21455
|
> **blob**: `Blob`
|
|
21260
21456
|
|
|
21261
|
-
Defined in: [lib/zip.ts:
|
|
21457
|
+
Defined in: [lib/zip.ts:485](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L485)
|
|
21262
21458
|
|
|
21263
21459
|
***
|
|
21264
21460
|
|
|
@@ -21266,7 +21462,7 @@ Defined in: [lib/zip.ts:483](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21266
21462
|
|
|
21267
21463
|
> **nodebuffer**: `Buffer`
|
|
21268
21464
|
|
|
21269
|
-
Defined in: [lib/zip.ts:
|
|
21465
|
+
Defined in: [lib/zip.ts:486](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L486)
|
|
21270
21466
|
|
|
21271
21467
|
***
|
|
21272
21468
|
|
|
@@ -21274,7 +21470,7 @@ Defined in: [lib/zip.ts:484](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21274
21470
|
|
|
21275
21471
|
> **string**: `string`
|
|
21276
21472
|
|
|
21277
|
-
Defined in: [lib/zip.ts:
|
|
21473
|
+
Defined in: [lib/zip.ts:479](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L479)
|
|
21278
21474
|
|
|
21279
21475
|
***
|
|
21280
21476
|
|
|
@@ -21282,7 +21478,7 @@ Defined in: [lib/zip.ts:477](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21282
21478
|
|
|
21283
21479
|
> **text**: `string`
|
|
21284
21480
|
|
|
21285
|
-
Defined in: [lib/zip.ts:
|
|
21481
|
+
Defined in: [lib/zip.ts:480](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L480)
|
|
21286
21482
|
|
|
21287
21483
|
***
|
|
21288
21484
|
|
|
@@ -21290,7 +21486,7 @@ Defined in: [lib/zip.ts:478](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21290
21486
|
|
|
21291
21487
|
> **uint8array**: `Uint8Array`
|
|
21292
21488
|
|
|
21293
|
-
Defined in: [lib/zip.ts:
|
|
21489
|
+
Defined in: [lib/zip.ts:483](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L483)
|
|
21294
21490
|
|
|
21295
21491
|
lib/zip/interfaces/IZipItem.md
|
|
21296
21492
|
---
|
|
@@ -21311,7 +21507,7 @@ Defined in: [lib/zip.ts:443](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21311
21507
|
|
|
21312
21508
|
> **compressedSize**: `number`
|
|
21313
21509
|
|
|
21314
|
-
Defined in: [lib/zip.ts:
|
|
21510
|
+
Defined in: [lib/zip.ts:446](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L446)
|
|
21315
21511
|
|
|
21316
21512
|
***
|
|
21317
21513
|
|
|
@@ -21319,7 +21515,7 @@ Defined in: [lib/zip.ts:445](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21319
21515
|
|
|
21320
21516
|
> **date**: `Date`
|
|
21321
21517
|
|
|
21322
|
-
Defined in: [lib/zip.ts:
|
|
21518
|
+
Defined in: [lib/zip.ts:448](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L448)
|
|
21323
21519
|
|
|
21324
21520
|
***
|
|
21325
21521
|
|
|
@@ -21327,7 +21523,7 @@ Defined in: [lib/zip.ts:447](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21327
21523
|
|
|
21328
21524
|
> **isDirectory**: `boolean`
|
|
21329
21525
|
|
|
21330
|
-
Defined in: [lib/zip.ts:
|
|
21526
|
+
Defined in: [lib/zip.ts:450](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L450)
|
|
21331
21527
|
|
|
21332
21528
|
***
|
|
21333
21529
|
|
|
@@ -21335,7 +21531,7 @@ Defined in: [lib/zip.ts:449](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21335
21531
|
|
|
21336
21532
|
> **isFile**: `boolean`
|
|
21337
21533
|
|
|
21338
|
-
Defined in: [lib/zip.ts:
|
|
21534
|
+
Defined in: [lib/zip.ts:449](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L449)
|
|
21339
21535
|
|
|
21340
21536
|
***
|
|
21341
21537
|
|
|
@@ -21343,7 +21539,9 @@ Defined in: [lib/zip.ts:448](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21343
21539
|
|
|
21344
21540
|
> **name**: `string`
|
|
21345
21541
|
|
|
21346
|
-
Defined in: [lib/zip.ts:
|
|
21542
|
+
Defined in: [lib/zip.ts:445](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L445)
|
|
21543
|
+
|
|
21544
|
+
文件/目录名(不含路径,不含前后斜杠)
|
|
21347
21545
|
|
|
21348
21546
|
***
|
|
21349
21547
|
|
|
@@ -21351,7 +21549,9 @@ Defined in: [lib/zip.ts:444](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21351
21549
|
|
|
21352
21550
|
> **path**: `string`
|
|
21353
21551
|
|
|
21354
|
-
Defined in: [lib/zip.ts:
|
|
21552
|
+
Defined in: [lib/zip.ts:452](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L452)
|
|
21553
|
+
|
|
21554
|
+
父目录路径(以 / 开头和结尾,如 /stc/ 或根目录 /),完整路径 = path + name
|
|
21355
21555
|
|
|
21356
21556
|
***
|
|
21357
21557
|
|
|
@@ -21359,7 +21559,7 @@ Defined in: [lib/zip.ts:450](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21359
21559
|
|
|
21360
21560
|
> **uncompressedSize**: `number`
|
|
21361
21561
|
|
|
21362
|
-
Defined in: [lib/zip.ts:
|
|
21562
|
+
Defined in: [lib/zip.ts:447](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L447)
|
|
21363
21563
|
|
|
21364
21564
|
lib/zip/interfaces/IZipMetadata.md
|
|
21365
21565
|
---
|
|
@@ -21372,7 +21572,7 @@ lib/zip/interfaces/IZipMetadata.md
|
|
|
21372
21572
|
|
|
21373
21573
|
# Interface: IZipMetadata
|
|
21374
21574
|
|
|
21375
|
-
Defined in: [lib/zip.ts:
|
|
21575
|
+
Defined in: [lib/zip.ts:493](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L493)
|
|
21376
21576
|
|
|
21377
21577
|
## Properties
|
|
21378
21578
|
|
|
@@ -21380,7 +21580,7 @@ Defined in: [lib/zip.ts:491](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21380
21580
|
|
|
21381
21581
|
> **currentFile**: `string` \| `null`
|
|
21382
21582
|
|
|
21383
|
-
Defined in: [lib/zip.ts:
|
|
21583
|
+
Defined in: [lib/zip.ts:495](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L495)
|
|
21384
21584
|
|
|
21385
21585
|
***
|
|
21386
21586
|
|
|
@@ -21388,7 +21588,7 @@ Defined in: [lib/zip.ts:493](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21388
21588
|
|
|
21389
21589
|
> **percent**: `number`
|
|
21390
21590
|
|
|
21391
|
-
Defined in: [lib/zip.ts:
|
|
21591
|
+
Defined in: [lib/zip.ts:494](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L494)
|
|
21392
21592
|
|
|
21393
21593
|
lib/zip/interfaces/IZipOutputByType.md
|
|
21394
21594
|
---
|
|
@@ -21401,7 +21601,7 @@ lib/zip/interfaces/IZipOutputByType.md
|
|
|
21401
21601
|
|
|
21402
21602
|
# Interface: IZipOutputByType
|
|
21403
21603
|
|
|
21404
|
-
Defined in: [lib/zip.ts:
|
|
21604
|
+
Defined in: [lib/zip.ts:463](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L463)
|
|
21405
21605
|
|
|
21406
21606
|
## Properties
|
|
21407
21607
|
|
|
@@ -21409,7 +21609,7 @@ Defined in: [lib/zip.ts:461](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21409
21609
|
|
|
21410
21610
|
> **array**: `number`[]
|
|
21411
21611
|
|
|
21412
|
-
Defined in: [lib/zip.ts:
|
|
21612
|
+
Defined in: [lib/zip.ts:468](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L468)
|
|
21413
21613
|
|
|
21414
21614
|
***
|
|
21415
21615
|
|
|
@@ -21417,7 +21617,7 @@ Defined in: [lib/zip.ts:466](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21417
21617
|
|
|
21418
21618
|
> **arraybuffer**: `ArrayBuffer`
|
|
21419
21619
|
|
|
21420
|
-
Defined in: [lib/zip.ts:
|
|
21620
|
+
Defined in: [lib/zip.ts:470](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L470)
|
|
21421
21621
|
|
|
21422
21622
|
***
|
|
21423
21623
|
|
|
@@ -21425,7 +21625,7 @@ Defined in: [lib/zip.ts:468](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21425
21625
|
|
|
21426
21626
|
> **base64**: `string`
|
|
21427
21627
|
|
|
21428
|
-
Defined in: [lib/zip.ts:
|
|
21628
|
+
Defined in: [lib/zip.ts:464](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L464)
|
|
21429
21629
|
|
|
21430
21630
|
***
|
|
21431
21631
|
|
|
@@ -21433,7 +21633,7 @@ Defined in: [lib/zip.ts:462](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21433
21633
|
|
|
21434
21634
|
> **binarystring**: `string`
|
|
21435
21635
|
|
|
21436
|
-
Defined in: [lib/zip.ts:
|
|
21636
|
+
Defined in: [lib/zip.ts:467](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L467)
|
|
21437
21637
|
|
|
21438
21638
|
***
|
|
21439
21639
|
|
|
@@ -21441,7 +21641,7 @@ Defined in: [lib/zip.ts:465](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21441
21641
|
|
|
21442
21642
|
> **blob**: `Blob`
|
|
21443
21643
|
|
|
21444
|
-
Defined in: [lib/zip.ts:
|
|
21644
|
+
Defined in: [lib/zip.ts:471](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L471)
|
|
21445
21645
|
|
|
21446
21646
|
***
|
|
21447
21647
|
|
|
@@ -21449,7 +21649,7 @@ Defined in: [lib/zip.ts:469](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21449
21649
|
|
|
21450
21650
|
> **nodebuffer**: `Buffer`
|
|
21451
21651
|
|
|
21452
|
-
Defined in: [lib/zip.ts:
|
|
21652
|
+
Defined in: [lib/zip.ts:472](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L472)
|
|
21453
21653
|
|
|
21454
21654
|
***
|
|
21455
21655
|
|
|
@@ -21457,7 +21657,7 @@ Defined in: [lib/zip.ts:470](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21457
21657
|
|
|
21458
21658
|
> **string**: `string`
|
|
21459
21659
|
|
|
21460
|
-
Defined in: [lib/zip.ts:
|
|
21660
|
+
Defined in: [lib/zip.ts:465](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L465)
|
|
21461
21661
|
|
|
21462
21662
|
***
|
|
21463
21663
|
|
|
@@ -21465,7 +21665,7 @@ Defined in: [lib/zip.ts:463](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21465
21665
|
|
|
21466
21666
|
> **text**: `string`
|
|
21467
21667
|
|
|
21468
|
-
Defined in: [lib/zip.ts:
|
|
21668
|
+
Defined in: [lib/zip.ts:466](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L466)
|
|
21469
21669
|
|
|
21470
21670
|
***
|
|
21471
21671
|
|
|
@@ -21473,7 +21673,7 @@ Defined in: [lib/zip.ts:464](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21473
21673
|
|
|
21474
21674
|
> **uint8array**: `Uint8Array`
|
|
21475
21675
|
|
|
21476
|
-
Defined in: [lib/zip.ts:
|
|
21676
|
+
Defined in: [lib/zip.ts:469](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L469)
|
|
21477
21677
|
|
|
21478
21678
|
lib/zip/interfaces/IZipStats.md
|
|
21479
21679
|
---
|
|
@@ -21486,7 +21686,7 @@ lib/zip/interfaces/IZipStats.md
|
|
|
21486
21686
|
|
|
21487
21687
|
# Interface: IZipStats
|
|
21488
21688
|
|
|
21489
|
-
Defined in: [lib/zip.ts:
|
|
21689
|
+
Defined in: [lib/zip.ts:455](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L455)
|
|
21490
21690
|
|
|
21491
21691
|
## Properties
|
|
21492
21692
|
|
|
@@ -21494,7 +21694,7 @@ Defined in: [lib/zip.ts:453](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21494
21694
|
|
|
21495
21695
|
> **compressedSize**: `number`
|
|
21496
21696
|
|
|
21497
|
-
Defined in: [lib/zip.ts:
|
|
21697
|
+
Defined in: [lib/zip.ts:456](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L456)
|
|
21498
21698
|
|
|
21499
21699
|
***
|
|
21500
21700
|
|
|
@@ -21502,7 +21702,7 @@ Defined in: [lib/zip.ts:454](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21502
21702
|
|
|
21503
21703
|
> **date**: `Date`
|
|
21504
21704
|
|
|
21505
|
-
Defined in: [lib/zip.ts:
|
|
21705
|
+
Defined in: [lib/zip.ts:458](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L458)
|
|
21506
21706
|
|
|
21507
21707
|
***
|
|
21508
21708
|
|
|
@@ -21510,7 +21710,7 @@ Defined in: [lib/zip.ts:456](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21510
21710
|
|
|
21511
21711
|
> **isDirectory**: `boolean`
|
|
21512
21712
|
|
|
21513
|
-
Defined in: [lib/zip.ts:
|
|
21713
|
+
Defined in: [lib/zip.ts:460](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L460)
|
|
21514
21714
|
|
|
21515
21715
|
***
|
|
21516
21716
|
|
|
@@ -21518,7 +21718,7 @@ Defined in: [lib/zip.ts:458](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21518
21718
|
|
|
21519
21719
|
> **isFile**: `boolean`
|
|
21520
21720
|
|
|
21521
|
-
Defined in: [lib/zip.ts:
|
|
21721
|
+
Defined in: [lib/zip.ts:459](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L459)
|
|
21522
21722
|
|
|
21523
21723
|
***
|
|
21524
21724
|
|
|
@@ -21526,7 +21726,7 @@ Defined in: [lib/zip.ts:457](https://github.com/maiyunnet/kebab/blob/master/lib/
|
|
|
21526
21726
|
|
|
21527
21727
|
> **uncompressedSize**: `number`
|
|
21528
21728
|
|
|
21529
|
-
Defined in: [lib/zip.ts:
|
|
21729
|
+
Defined in: [lib/zip.ts:457](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L457)
|
|
21530
21730
|
|
|
21531
21731
|
lib/zip/type-aliases/TZipInputFileFormat.md
|
|
21532
21732
|
---
|
|
@@ -21541,7 +21741,7 @@ lib/zip/type-aliases/TZipInputFileFormat.md
|
|
|
21541
21741
|
|
|
21542
21742
|
> **TZipInputFileFormat** = [`IZipInputByType`](../interfaces/IZipInputByType.md)\[keyof [`IZipInputByType`](../interfaces/IZipInputByType.md)\]
|
|
21543
21743
|
|
|
21544
|
-
Defined in: [lib/zip.ts:
|
|
21744
|
+
Defined in: [lib/zip.ts:491](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L491)
|
|
21545
21745
|
|
|
21546
21746
|
lib/zip/type-aliases/TZipInputType.md
|
|
21547
21747
|
---
|
|
@@ -21556,7 +21756,7 @@ lib/zip/type-aliases/TZipInputType.md
|
|
|
21556
21756
|
|
|
21557
21757
|
> **TZipInputType** = keyof [`IZipInputByType`](../interfaces/IZipInputByType.md)
|
|
21558
21758
|
|
|
21559
|
-
Defined in: [lib/zip.ts:
|
|
21759
|
+
Defined in: [lib/zip.ts:489](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L489)
|
|
21560
21760
|
|
|
21561
21761
|
lib/zip/type-aliases/TZipOutputType.md
|
|
21562
21762
|
---
|
|
@@ -21571,7 +21771,7 @@ lib/zip/type-aliases/TZipOutputType.md
|
|
|
21571
21771
|
|
|
21572
21772
|
> **TZipOutputType** = keyof [`IZipOutputByType`](../interfaces/IZipOutputByType.md)
|
|
21573
21773
|
|
|
21574
|
-
Defined in: [lib/zip.ts:
|
|
21774
|
+
Defined in: [lib/zip.ts:475](https://github.com/maiyunnet/kebab/blob/master/lib/zip.ts#L475)
|
|
21575
21775
|
|
|
21576
21776
|
lib/zlib/functions/brotliCompress.md
|
|
21577
21777
|
---
|
|
@@ -22599,19 +22799,19 @@ Defined in: [sys/ctr.ts:978](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
22599
22799
|
|
|
22600
22800
|
`string`
|
|
22601
22801
|
|
|
22602
|
-
|
|
22802
|
+
允许的请求头,默认 '*'
|
|
22603
22803
|
|
|
22604
22804
|
###### methods?
|
|
22605
22805
|
|
|
22606
22806
|
`string`
|
|
22607
22807
|
|
|
22608
|
-
|
|
22808
|
+
允许的方法,默认 '*'
|
|
22609
22809
|
|
|
22610
22810
|
###### origins?
|
|
22611
22811
|
|
|
22612
22812
|
`string`[]
|
|
22613
22813
|
|
|
22614
|
-
|
|
22814
|
+
允许的来源列表,默认 '*'
|
|
22615
22815
|
|
|
22616
22816
|
#### Returns
|
|
22617
22817
|
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '9.
|
|
9
|
+
export const VER = '9.13.1';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/s3.d.ts
CHANGED
|
@@ -31,6 +31,39 @@ export interface IOptions {
|
|
|
31
31
|
/** --- 预定义 bucket --- */
|
|
32
32
|
'bucket'?: string;
|
|
33
33
|
}
|
|
34
|
+
/** --- 批量上传单项 --- */
|
|
35
|
+
export interface IPutObjectItem {
|
|
36
|
+
/** --- 对象路径 --- */
|
|
37
|
+
'key': string;
|
|
38
|
+
/** --- 内容 --- */
|
|
39
|
+
'content': string | Buffer | stream.Readable;
|
|
40
|
+
/** --- contentLength,流模式需要设置 --- */
|
|
41
|
+
'length'?: number;
|
|
42
|
+
/** --- content-type,如 application/javascript --- */
|
|
43
|
+
'type'?: string;
|
|
44
|
+
/** --- content-disposition --- */
|
|
45
|
+
'disposition'?: string;
|
|
46
|
+
/** --- bucket 名,优先级高于 options.bucket --- */
|
|
47
|
+
'bucket'?: string;
|
|
48
|
+
}
|
|
49
|
+
/** --- 批量上传选项 --- */
|
|
50
|
+
export interface IPutObjectsOptions {
|
|
51
|
+
/** --- 并发数,默认 5 --- */
|
|
52
|
+
'concurrency'?: number;
|
|
53
|
+
/** --- bucket 名 --- */
|
|
54
|
+
'bucket'?: string;
|
|
55
|
+
}
|
|
56
|
+
/** --- 批量上传单项结果 --- */
|
|
57
|
+
export interface IPutObjectsItemResult {
|
|
58
|
+
/** --- 对象路径 --- */
|
|
59
|
+
'key': string;
|
|
60
|
+
/** --- 是否成功 --- */
|
|
61
|
+
'success': boolean;
|
|
62
|
+
/** --- 对象访问地址,成功时返回 --- */
|
|
63
|
+
'location'?: string;
|
|
64
|
+
/** --- 错误信息,失败时返回 --- */
|
|
65
|
+
'error'?: string;
|
|
66
|
+
}
|
|
34
67
|
export declare class S3 {
|
|
35
68
|
private readonly _link;
|
|
36
69
|
/** --- bucket 名 --- */
|
|
@@ -56,6 +89,12 @@ export declare class S3 {
|
|
|
56
89
|
'disposition'?: string;
|
|
57
90
|
'bucket'?: string;
|
|
58
91
|
}, bucket?: string): Promise<s3.CompleteMultipartUploadCommandOutput | false>;
|
|
92
|
+
/**
|
|
93
|
+
* --- 批量上传对象,并发控制,单次失败不影响其他项 ---
|
|
94
|
+
* @param items 上传项列表
|
|
95
|
+
* @param options 批量上传选项
|
|
96
|
+
*/
|
|
97
|
+
putObjects(items: IPutObjectItem[], options?: IPutObjectsOptions): Promise<IPutObjectsItemResult[]>;
|
|
59
98
|
/**
|
|
60
99
|
* --- 获取对象流,可通过流获取 buffer 或 text ---
|
|
61
100
|
* @param key 对象路径
|
package/lib/s3.js
CHANGED
|
@@ -104,12 +104,51 @@ export class S3 {
|
|
|
104
104
|
return false;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* --- 批量上传对象,并发控制,单次失败不影响其他项 ---
|
|
109
|
+
* @param items 上传项列表
|
|
110
|
+
* @param options 批量上传选项
|
|
111
|
+
*/
|
|
112
|
+
async putObjects(items, options) {
|
|
113
|
+
const concurrency = options?.concurrency ?? 5;
|
|
114
|
+
const sharedBucket = options?.bucket;
|
|
115
|
+
const results = new Array(items.length);
|
|
116
|
+
let cursor = 0;
|
|
117
|
+
const worker = async () => {
|
|
118
|
+
while (cursor < items.length) {
|
|
119
|
+
const i = cursor++;
|
|
120
|
+
const item = items[i];
|
|
121
|
+
const bucket = item.bucket ?? sharedBucket;
|
|
122
|
+
const res = await this.putObject(item.key, item.content, {
|
|
123
|
+
'length': item.length,
|
|
124
|
+
'type': item.type,
|
|
125
|
+
'disposition': item.disposition,
|
|
126
|
+
}, bucket);
|
|
127
|
+
if (res) {
|
|
128
|
+
results[i] = {
|
|
129
|
+
'key': item.key,
|
|
130
|
+
'success': true,
|
|
131
|
+
'location': res.Location,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
results[i] = {
|
|
136
|
+
'key': item.key,
|
|
137
|
+
'success': false,
|
|
138
|
+
'error': 'upload failed',
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
const workers = Array.from({ 'length': Math.min(concurrency, items.length) }, () => worker());
|
|
144
|
+
await Promise.all(workers);
|
|
145
|
+
return results;
|
|
146
|
+
}
|
|
107
147
|
/**
|
|
108
148
|
* --- 获取对象流,可通过流获取 buffer 或 text ---
|
|
109
149
|
* @param key 对象路径
|
|
110
150
|
* @param bucket bucket 名
|
|
111
151
|
*/
|
|
112
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
113
152
|
async getObject(key, bucket) {
|
|
114
153
|
try {
|
|
115
154
|
const go = new s3.GetObjectCommand({
|
package/lib/undici/response.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare class Response {
|
|
|
31
31
|
/**
|
|
32
32
|
* --- 获取响应读取流对象 ---
|
|
33
33
|
*/
|
|
34
|
-
getStream(): (import("undici/types/readable").default & undici.Dispatcher.BodyMixin) |
|
|
34
|
+
getStream(): zlib.BrotliDecompress | zlib.Gunzip | zlib.Inflate | (import("undici/types/readable").default & undici.Dispatcher.BodyMixin) | null;
|
|
35
35
|
/**
|
|
36
36
|
* --- 获取原生响应读取流对象 ---
|
|
37
37
|
*/
|
package/lib/undici.js
CHANGED
|
@@ -472,6 +472,8 @@ const proxyContinueHeaders = [
|
|
|
472
472
|
*/
|
|
473
473
|
export function filterHeaders(headers, res, filter) {
|
|
474
474
|
const heads = {};
|
|
475
|
+
// --- HTTP/2 下响应已发送则跳过 setHeader,避免 ERR_HTTP2_HEADERS_SENT ---
|
|
476
|
+
const sent = res ? res.headersSent : false;
|
|
475
477
|
for (const h in headers) {
|
|
476
478
|
if (proxyContinueHeaders.includes(h)) {
|
|
477
479
|
continue;
|
|
@@ -487,7 +489,9 @@ export function filterHeaders(headers, res, filter) {
|
|
|
487
489
|
continue;
|
|
488
490
|
}
|
|
489
491
|
if (res) {
|
|
490
|
-
|
|
492
|
+
if (!sent) {
|
|
493
|
+
res.setHeader(h, v);
|
|
494
|
+
}
|
|
491
495
|
continue;
|
|
492
496
|
}
|
|
493
497
|
heads[h] = v;
|
|
@@ -534,15 +538,24 @@ export async function mproxy(ctr, auth, opt = {}) {
|
|
|
534
538
|
if (rres.error) {
|
|
535
539
|
return -2;
|
|
536
540
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
541
|
+
// --- HTTP/2 下响应可能已被客户端取消,跳过头部设置避免崩溃 ---
|
|
542
|
+
if (!res.headersSent) {
|
|
543
|
+
if (rres.headers) {
|
|
544
|
+
filterHeaders(rres.headers, res, opt.filter);
|
|
545
|
+
}
|
|
546
|
+
lCore.writeHead(res, rres.headers?.['http-code'] ?? 200);
|
|
547
|
+
await new Promise(resolve => {
|
|
548
|
+
// --- 上游流出错时主动销毁响应流,避免连接挂起 ---
|
|
549
|
+
stream.on('error', (err) => {
|
|
550
|
+
lCore.log({}, `[UNDICI][MPROXY] upstream stream error: ${err.message}`, '-neterror');
|
|
551
|
+
res.destroy();
|
|
552
|
+
});
|
|
553
|
+
// --- 同时监听 close 确保 promise 一定会 resolve(客户端断连等场景) ---
|
|
554
|
+
stream.pipe(res).on('close', () => {
|
|
555
|
+
resolve();
|
|
556
|
+
});
|
|
544
557
|
});
|
|
545
|
-
}
|
|
558
|
+
}
|
|
546
559
|
return 1;
|
|
547
560
|
}
|
|
548
561
|
/**
|
|
@@ -618,29 +631,38 @@ export async function rproxy(ctr, route, opt = {}) {
|
|
|
618
631
|
if (rres.error) {
|
|
619
632
|
return false;
|
|
620
633
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
}
|
|
631
|
-
lCore.writeHead(res, rres.headers?.['http-code'] ?? 200);
|
|
632
|
-
await new Promise((resolve) => {
|
|
634
|
+
// --- HTTP/2 下响应可能已被客户端取消,跳过头部设置避免崩溃 ---
|
|
635
|
+
if (!res.headersSent) {
|
|
636
|
+
if (rres.headers) {
|
|
637
|
+
filterHeaders(rres.headers, res, opt.filter);
|
|
638
|
+
}
|
|
639
|
+
/** --- 上游已压缩则不再压缩,避免双重压缩导致乱码 --- */
|
|
640
|
+
const upstreamEncoded = !!(rres.headers?.['content-encoding']);
|
|
641
|
+
/** --- 当前的压缩对象 --- */
|
|
642
|
+
const compress = upstreamEncoded ? null : lZlib.createCompress(req.headers['accept-encoding'] ?? '');
|
|
633
643
|
if (compress) {
|
|
634
|
-
|
|
635
|
-
resolve();
|
|
636
|
-
});
|
|
644
|
+
res.setHeader('content-encoding', compress.type);
|
|
637
645
|
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
646
|
+
lCore.writeHead(res, rres.headers?.['http-code'] ?? 200);
|
|
647
|
+
await new Promise((resolve) => {
|
|
648
|
+
// --- 上游流出错时主动销毁响应流,避免连接挂起 ---
|
|
649
|
+
stream.on('error', (err) => {
|
|
650
|
+
lCore.log({}, `[UNDICI][RPROXY] upstream stream error: ${err.message}`, '-neterror');
|
|
651
|
+
res.destroy();
|
|
641
652
|
});
|
|
642
|
-
|
|
643
|
-
|
|
653
|
+
// --- 同时监听 close 确保 promise 一定会 resolve(客户端断连等场景) ---
|
|
654
|
+
if (compress) {
|
|
655
|
+
stream.pipe(compress.compress).pipe(res).on('close', () => {
|
|
656
|
+
resolve();
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
else {
|
|
660
|
+
stream.pipe(res).on('close', () => {
|
|
661
|
+
resolve();
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
});
|
|
665
|
+
}
|
|
644
666
|
return true;
|
|
645
667
|
}
|
|
646
668
|
return false;
|
package/lib/zip.d.ts
CHANGED
|
@@ -90,12 +90,14 @@ export declare class Zip {
|
|
|
90
90
|
*/
|
|
91
91
|
export declare function get(data?: TZipInputFileFormat): Promise<Zip | null>;
|
|
92
92
|
export interface IZipItem {
|
|
93
|
+
/** --- 文件/目录名(不含路径,不含前后斜杠) --- */
|
|
93
94
|
'name': string;
|
|
94
95
|
'compressedSize': number;
|
|
95
96
|
'uncompressedSize': number;
|
|
96
97
|
'date': Date;
|
|
97
98
|
'isFile': boolean;
|
|
98
99
|
'isDirectory': boolean;
|
|
100
|
+
/** --- 父目录路径(以 / 开头和结尾,如 /stc/ 或根目录 /),完整路径 = path + name --- */
|
|
99
101
|
'path': string;
|
|
100
102
|
}
|
|
101
103
|
export interface IZipStats {
|
package/package.json
CHANGED
package/sys/child.js
CHANGED
package/sys/ctr.d.ts
CHANGED
|
@@ -283,11 +283,11 @@ export declare class Ctr {
|
|
|
283
283
|
* 返回 true 接续执行,返回 false 需要中断用户本次访问(options 请求)
|
|
284
284
|
*/
|
|
285
285
|
protected _cross(opt?: {
|
|
286
|
-
/** ---
|
|
286
|
+
/** --- 允许的来源列表,默认 '*' --- */
|
|
287
287
|
'origins'?: string[];
|
|
288
|
-
/** ---
|
|
288
|
+
/** --- 允许的请求头,默认 '*' --- */
|
|
289
289
|
'headers'?: string;
|
|
290
|
-
/** ---
|
|
290
|
+
/** --- 允许的方法,默认 '*' --- */
|
|
291
291
|
'methods'?: string;
|
|
292
292
|
/** --- 是否允许发送凭据(cookie),默认 false --- */
|
|
293
293
|
'credentials'?: boolean;
|