Mongoose always buffers a full HTTP message before invoking
the MG_EV_HTTP_MSG event. A big POST request would require a lot
of RAM to buffer everything. Therefore, in order to upload large
files on memory-constrained systems, a large file should be sent
in small chunks.
In this example, the JavaScript code on this page sends the chosen
file in 4K chunks using the /upload
endpoint.
The uploaded file is stored in the /tmp
directory by
the helper API function mg_http_upload()