cmorten / opine

Minimalist web framework for Deno ported from ExpressJS.
https://github.com/cmorten/opine/blob/main/.github/API/api.md
MIT License
854 stars 43 forks source link

How to upload file?? #171

Closed devalexqt closed 2 years ago

devalexqt commented 2 years ago

How to upload big file 1G ?

cmorten commented 2 years ago

Opine doesn't provide out of the box behaviours for large files, you will need to either write custom code to consume the request yourself or use a third party middleware for processing.

Refer to docs on req.body --> https://github.com/cmorten/opine/blob/main/.github/API/request.md#reqbody

As the body is large, would not recommend reading it all into memory as the example suggests, but instead in chunks (potentially writing to disk) using something like multipart/form-data.

If looking to write your own, recommend checking out how it is done in Oak --> https://github.com/oakserver/oak/blob/main/multipart.ts