Multipart upload streaming (busboy)

3787
0

Multipart uploads can blow up memory if you parse them naively. With busboy, I stream file data as it arrives and enforce size limits and content-type checks early. I avoid writing to disk unless I need it; for many flows I stream directly to object storage. The most important detail is setting hard limits so a client can’t send a 5GB file and tie up your server—return 413 when you hit the cap. I also handle ‘field’ parts separately and validate them just like JSON bodies. Once uploads are streaming, peak memory stays stable.