File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -46,17 +46,14 @@ http.createServer(async (req, res) => {
4646 if (req .method === " POST" && req .headers [" content-type" ]) {
4747
4848 // get the request body
49- const chunks : Uint8Array [] = [];
49+ const body : Uint8Array [] = [];
5050 for await (const chunk of req )
51- chunks .push (chunk );
52- const body = Buffer .concat (chunks );
53-
54- // create a multipart component to hold the content-type header (which includes the boundary) and the body
55- const component = new Component ({
56- " Content-Type" : req .headers [" content-type" ]
57- }, body );
58- // parse multipart from the component
59- const multipart = Multipart .part (component );
51+ body .push (chunk );
52+
53+ // create a blob to hold the Content-Type header (which includes the boundary) and the body
54+ const blob = new Blob (body , {type: req .headers [" content-type" ]});
55+ // parse multipart from the blob
56+ const multipart = await Multipart .blob (blob );
6057 console .log (multipart );
6158
6259 res .end (" ok" );
You can’t perform that action at this time.
0 commit comments