@@ -23,7 +23,20 @@ export default eventHandler(async () => {
23
23
24
24
#### Params
25
25
26
- - ` options ` : [ ` BlobListOptions ` ] ( #bloblistoptions )
26
+ :: field-group
27
+ :: field { name =" options " type =" Object " }
28
+ The list options.
29
+ ::field{name="limit" type="Number"}
30
+ The maximum number of blobs to return per request. Defaults to `1000`.
31
+ ::
32
+ ::field{name="prefix" type="String"}
33
+ Filters the results to only those that begin with the specified prefix.
34
+ ::
35
+ ::field{name="cursor" type="String"}
36
+ The cursor to continue from a previous list operation.
37
+ ::
38
+ ::
39
+ ::
27
40
28
41
#### Return
29
42
@@ -43,8 +56,14 @@ export default eventHandler(async (event) => {
43
56
44
57
#### Params
45
58
46
- - ` event ` : [ ` H3Event ` ] ( https://github.com/unjs/h3 ) {target=_ blank}
47
- - ` pathname ` : ` string `
59
+ :: field-group
60
+ :: field { name =" event " type =" H3Event " }
61
+ Handler's event, needed to set headers.
62
+ ::
63
+ :: field { name =" pathname " type =" String " }
64
+ The name of the blob to serve.
65
+ ::
66
+ ::
48
67
49
68
#### Return
50
69
@@ -68,7 +87,11 @@ const blob = await useBlob().head(pathname)
68
87
69
88
#### Params
70
89
71
- - ` pathname ` : ` string `
90
+ :: field-group
91
+ :: field { name =" pathname " type =" String " }
92
+ The name of the blob to serve.
93
+ ::
94
+ ::
72
95
73
96
#### Return
74
97
@@ -96,9 +119,26 @@ export default eventHandler(async (event) => {
96
119
97
120
#### Params
98
121
99
- - ` pathname ` : ` string `
100
- - ` body ` : ` string ` | ` ReadableStream<any> ` | ` ArrayBuffer ` | ` ArrayBufferView ` | ` Blob `
101
- - ` options ` : [ ` BlobPutOptions ` ] ( #blobputoptions )
122
+ :: field-group
123
+ :: field { name =" pathname " type =" String " }
124
+ The name of the blob to serve.
125
+ ::
126
+ :: field { name =" body " type =" String | ReadableStream<any> | ArrayBuffer | ArrayBufferView | Blob " }
127
+ The blob's data.
128
+ ::
129
+ :: field { name =" options " type =" Object " }
130
+ The put options. Any other provided field will be stored in the blob's metadata.
131
+ ::field{name="contentType" type="String"}
132
+ The content type of the blob. If not given, it will be inferred from the Blob or the file extension.
133
+ ::
134
+ ::field{name="contentLength" type="String"}
135
+ The content length of the blob.
136
+ ::
137
+ ::field{name="addRandomSuffix" type="Boolean"}
138
+ If `true`, a random suffix will be added to the blob's name. Defaults to `false`.
139
+ ::
140
+ ::
141
+ ::
102
142
103
143
#### Return
104
144
@@ -120,7 +160,11 @@ export default eventHandler(async (event) => {
120
160
121
161
#### Params
122
162
123
- - ` pathname ` : ` string `
163
+ :: field-group
164
+ :: field { name =" pathname " type =" String " }
165
+ The name of the blob to serve.
166
+ ::
167
+ ::
124
168
125
169
#### Return
126
170
@@ -140,17 +184,17 @@ ensureBlob(file, { maxSize: '1MB', types: ['image' ]})
140
184
141
185
:: field-group
142
186
:: field { name =" file " type =" Blob " required }
143
- The file to validate.
187
+ The file to validate.
144
188
::
145
189
:: field { name =" options " type =" Object " required }
146
190
Note that at least `maxSize` or `types` should be provided.
147
191
::field{name="maxSize" type="BlobSize"}
148
- The maximum size of the file, should be: :br
149
- (`1` | `2` | `4` | `8` | `16` | `32` | `64` | `128` | `256` | `512` | `1024`) + (`B` | `KB` | `MB` | `GB`) :br
150
- e.g. `'512KB'`, `'1MB'`, `'2GB'`, etc.
192
+ The maximum size of the file, should be: :br
193
+ (`1` | `2` | `4` | `8` | `16` | `32` | `64` | `128` | `256` | `512` | `1024`) + (`B` | `KB` | `MB` | `GB`) :br
194
+ e.g. `'512KB'`, `'1MB'`, `'2GB'`, etc.
151
195
::
152
196
::field{name="types" type="BlobType[]"}
153
- Allowed types of the file, e.g. `['image/jpeg']`.
197
+ Allowed types of the file, e.g. `['image/jpeg']`.
154
198
::
155
199
::
156
200
::
@@ -163,31 +207,6 @@ Throws an error if `file` doesn't meet the requirements.
163
207
164
208
## Types
165
209
166
- ### ` BlobListOptions `
167
-
168
- ``` ts
169
- interface BlobListOptions {
170
- /**
171
- * The maximum number of blobs to return per request.
172
- * @default 1000
173
- */
174
- limit? : number
175
- prefix? : string
176
- cursor? : string
177
- }
178
- ```
179
-
180
- ### ` BlobPutOptions `
181
-
182
- ``` ts
183
- interface BlobPutOptions {
184
- contentType? : string ,
185
- contentLength? : string ,
186
- addRandomSuffix? : boolean ,
187
- [key : string ]: any
188
- }
189
- ```
190
-
191
210
### ` BlobObject `
192
211
193
212
``` ts
0 commit comments