Mongoose always buffers a full HTTP message before invoking MG_EV_HTTP_MSG event. Big POST request require of lot of RAM to buffer everything. Therefore, in order to upload large files on memory-constrained system, a large file should be send in small chunks.

In this example, JavaScript code on this page sends uploaded file in 2k chunks using an /upload endpoint. Uploaded file is stored in /tmp directory by the helper API function mg_http_upload()